mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
UBERF-7118: Fix upgrade/refresh on reconnect (#5704)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
3e913c9db7
commit
42d8c4582c
@ -276,10 +276,10 @@ export function startHttpServer (
|
||||
|
||||
if (webSocketData.session instanceof Promise) {
|
||||
void webSocketData.session.then((s) => {
|
||||
if ('upgrade' in s || 'error' in s) {
|
||||
if ('error' in s) {
|
||||
ctx.error('error', { error: s.error?.message, stack: s.error?.stack })
|
||||
}
|
||||
if ('error' in s) {
|
||||
ctx.error('error', { error: s.error?.message, stack: s.error?.stack })
|
||||
}
|
||||
if ('upgrade' in s) {
|
||||
void cs
|
||||
.send(ctx, { id: -1, result: { state: 'upgrading', stats: (s as any).upgradeInfo } }, false, false)
|
||||
.then(() => {
|
||||
|
@ -126,7 +126,8 @@ export function startUWebsocketServer (
|
||||
mode: data.payload.extra?.mode,
|
||||
model: data.payload.extra?.model
|
||||
}
|
||||
data.connectionSocket = createWebSocketClientSocket(wrData, ws, data)
|
||||
const cs = createWebSocketClientSocket(wrData, ws, data)
|
||||
data.connectionSocket = cs
|
||||
|
||||
data.session = sessions.addSession(
|
||||
ctx,
|
||||
@ -138,6 +139,21 @@ export function startUWebsocketServer (
|
||||
undefined,
|
||||
accountsUrl
|
||||
)
|
||||
|
||||
if (data.session instanceof Promise) {
|
||||
void data.session.then((s) => {
|
||||
if ('error' in s) {
|
||||
ctx.error('error', { error: s.error?.message, stack: s.error?.stack })
|
||||
}
|
||||
if ('upgrade' in s) {
|
||||
void cs
|
||||
.send(ctx, { id: -1, result: { state: 'upgrading', stats: (s as any).upgradeInfo } }, false, false)
|
||||
.then(() => {
|
||||
cs.close()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
message: (ws, message, isBinary) => {
|
||||
const data = ws.getUserData()
|
||||
|
Loading…
Reference in New Issue
Block a user