mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-22 20:32:24 +02:00
qfix: connect timeout + service ws info cache (#9622)
1. Fix connect timeout in case of maitenance 2. Introduce workspace info cache for service accounts 3. Fix null in github integration Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -134,6 +134,16 @@ export class PlatformWorker {
|
||||
workspace: i.workspaceUuid,
|
||||
installationId: Array.isArray(installationId) ? installationId : [installationId]
|
||||
})
|
||||
} else {
|
||||
ctx.warn('Integration without installationId', {
|
||||
accountId: i.socialId,
|
||||
workspace: i.workspaceUuid
|
||||
})
|
||||
await accountsClient.deleteIntegration({
|
||||
kind: 'github',
|
||||
workspaceUuid: i.workspaceUuid,
|
||||
socialId: i.socialId
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,9 +1086,9 @@ export class PlatformWorker {
|
||||
index: widx,
|
||||
total: workspaces.length
|
||||
})
|
||||
// No if no integration, we will try connect one more time in a time period
|
||||
this.clients.set(workspace, worker)
|
||||
} else {
|
||||
// No if no integration, we will try connect one more time in a time period
|
||||
workerCtx.info(
|
||||
'************************* Failed Register worker, timeout or integrations removed *************************',
|
||||
{
|
||||
|
||||
@@ -1753,8 +1753,14 @@ export class GithubWorker implements IntegrationManager {
|
||||
ctx.info('Connecting to', { workspace })
|
||||
let client: Client | undefined
|
||||
let endpoint: string | undefined
|
||||
let maitenanceState = false
|
||||
try {
|
||||
;({ client, endpoint } = await createPlatformClient(workspace.uuid, 30000, async (event: ClientConnectEvent) => {
|
||||
if (event === ClientConnectEvent.Maintenance) {
|
||||
await client?.close()
|
||||
maitenanceState = true
|
||||
throw new Error('Workspace in maintenance')
|
||||
}
|
||||
reconnect(workspace.uuid, event)
|
||||
}))
|
||||
ctx.info('connected to github', { workspace: workspace.uuid, endpoint })
|
||||
@@ -1781,8 +1787,12 @@ export class GithubWorker implements IntegrationManager {
|
||||
void worker.init()
|
||||
return worker
|
||||
} catch (err: any) {
|
||||
ctx.error('timeout during to connect', { workspace, error: err })
|
||||
await client?.close()
|
||||
if (maitenanceState) {
|
||||
ctx.info('workspace in maintenance, schedule recheck', { workspace: workspace.uuid, endpoint })
|
||||
return
|
||||
}
|
||||
ctx.error('timeout during to connect', { workspace, error: err })
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user