Skip to content

Commit

Permalink
UBERF-7743: Make check-clean non blocking (#6195)
Browse files Browse the repository at this point in the history
  • Loading branch information
haiodo authored Jul 31, 2024
1 parent 824defc commit 623649f
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions services/github/pod-github/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,26 @@ export class PlatformWorker {
}
}

for (const workspace of workspacesToCheck) {
// We need to connect to workspace and verify all installations and clean if required
try {
ctx.info('check clean', { workspace })
await this.cleanWorkspaceInstallations(ctx, workspace)
} catch (err: any) {
ctx.error('failed to clean workspace', { err, workspace })
const checkClean = async (): Promise<void> => {
const rateLimit = new RateLimiter(10)
for (const workspace of workspacesToCheck) {
// We need to connect to workspace and verify all installations and clean if required
try {
await rateLimit.add(async () => {
ctx.info('check clean', { workspace })
try {
await this.cleanWorkspaceInstallations(ctx, workspace)
} catch (err: any) {
ctx.error('failed to check clean', { workspace })
}
})
} catch (err: any) {
ctx.error('failed to clean workspace', { err, workspace })
}
}
await rateLimit.waitProcessing()
}
void checkClean()

void this.doSyncWorkspaces().catch((err) => {
ctx.error('error during sync workspaces', { err })
Expand Down Expand Up @@ -220,7 +231,7 @@ export class PlatformWorker {
try {
workspaceInfo = await getWorkspaceInfo(token)
} catch (err: any) {
this.ctx.error('Workspace not found:', { workspace })
ctx.error('Workspace not found:', { workspace })
return
}
if (workspaceInfo === undefined) {
Expand Down

0 comments on commit 623649f

Please sign in to comment.