Skip to content

Commit 7fa1b2d

Browse files
authored
[server] Tone down non-error log messages during workspace start/reconcile (#18720)
1 parent d053e39 commit 7fa1b2d

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

components/server/src/jobs/runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class JobRunner {
108108
});
109109
});
110110
} catch (err) {
111-
if (RedisMutex.isLockError(err)) {
111+
if (RedisMutex.isLockedError(err)) {
112112
log.debug(
113113
`Failed to acquire lock for job ${job.name}. Likely another instance already holds the lock.`,
114114
err,

components/server/src/redis/mutex.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ export class RedisMutex {
4545
return this.client().using(resources, duration, settings, routine);
4646
}
4747

48-
public static isLockError(err: any): boolean {
49-
return err instanceof ResourceLockedError || err instanceof ExecutionError;
48+
public static isLockedError(err: any): boolean {
49+
return (
50+
err instanceof ResourceLockedError ||
51+
// Should be a ResourceLockedError as well, but is ExecutionError in v5.x: https://github.com/mike-marcacci/node-redlock/issues/168
52+
(err instanceof ExecutionError &&
53+
err.message.includes("unable to achieve a quorum during its retry window"))
54+
);
5055
}
5156
}

components/server/src/workspace/workspace-starter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,8 @@ export class WorkspaceStarter {
419419
{ retryCount: 4, retryDelay: 500 }, // We wait at most 2s until we give up, and conclude that someone else is already starting this instance
420420
)
421421
.catch((err) => {
422-
if (RedisMutex.isLockError(err)) {
423-
log.warn({ instanceId }, "unable to acquire lock for workspace instance start");
424-
return;
422+
if (!RedisMutex.isLockedError(err)) {
423+
log.warn({ instanceId }, "unexpected error during workspace instance start", err);
425424
}
426425
});
427426
}
@@ -582,9 +581,10 @@ export class WorkspaceStarter {
582581
// due to the reconciliation loop we might have already started the workspace, especially in the "pending" phase
583582
const workspaceAlreadyExists = await this.existsWithWsManager(ctx, instance);
584583
if (workspaceAlreadyExists) {
585-
log.warn(
584+
log.debug(
586585
{ instanceId: instance.id, workspaceId: instance.workspaceId },
587586
"workspace already exists, not starting again",
587+
{ phase: instance.status.phase },
588588
);
589589
return;
590590
}

0 commit comments

Comments
 (0)