Fix upgrade failed (#6432)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-08-29 16:47:46 +07:00 committed by GitHub
parent 1667581b5f
commit d3ad61b842
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View File

@ -120,6 +120,8 @@ export class UpgradeWorker {
ctx.error('error', { err }) ctx.error('error', { err })
} }
Analytics.handleError(err)
ctx.info('---failed---------', { ctx.info('---failed---------', {
pending: this.toProcess, pending: this.toProcess,
time: Date.now() - t, time: Date.now() - t,

View File

@ -431,12 +431,17 @@ export async function upgradeModel (
ctx.info('send force close', { workspace: workspaceId.name, transactorUrl }) ctx.info('send force close', { workspace: workspaceId.name, transactorUrl })
const serverEndpoint = transactorUrl.replaceAll('wss://', 'https://').replace('ws://', 'http://') const serverEndpoint = transactorUrl.replaceAll('wss://', 'https://').replace('ws://', 'http://')
const token = generateToken(systemAccountEmail, workspaceId, { admin: 'true' }) const token = generateToken(systemAccountEmail, workspaceId, { admin: 'true' })
try {
await fetch( await fetch(
serverEndpoint + `/api/v1/manage?token=${token}&operation=force-close&wsId=${toWorkspaceString(workspaceId)}`, serverEndpoint +
`/api/v1/manage?token=${token}&operation=force-close&wsId=${toWorkspaceString(workspaceId)}`,
{ {
method: 'PUT' method: 'PUT'
} }
) )
} catch (err: any) {
// Ignore error if transactor is not yet ready
}
} }
} finally { } finally {
await connection?.sendForceClose() await connection?.sendForceClose()