From 13dfe82c9311174df3c465ee414543058729fbce Mon Sep 17 00:00:00 2001 From: Milan Pavlik Date: Wed, 26 Apr 2023 08:52:48 +0000 Subject: [PATCH 1/3] [server] Increase initial lock duration for wsgc --- components/server/src/workspace/garbage-collector.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/server/src/workspace/garbage-collector.ts b/components/server/src/workspace/garbage-collector.ts index 989a5b1121aa22..0963819ae4a2c0 100644 --- a/components/server/src/workspace/garbage-collector.ts +++ b/components/server/src/workspace/garbage-collector.ts @@ -43,8 +43,9 @@ export class WorkspaceGarbageCollector { } public async garbageCollectWorkspacesIfLeader() { + const initialLockDuration = 5 * 60 * 1000; try { - await this.mutex.client().using(["workspace-gc"], 30 * 1000, async (signal) => { + await this.mutex.client().using(["workspace-gc"], initialLockDuration, async (signal) => { log.info("wsgc: acquired workspace-gc lock. Collecting old workspaces"); try { await this.softDeleteOldWorkspaces(); From 256632e8eac9d6038d7347b4aede636c8b7e2f2b Mon Sep 17 00:00:00 2001 From: Milan Pavlik Date: Wed, 26 Apr 2023 08:54:58 +0000 Subject: [PATCH 2/3] fix --- components/server/src/workspace/garbage-collector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/server/src/workspace/garbage-collector.ts b/components/server/src/workspace/garbage-collector.ts index 0963819ae4a2c0..d16baf866ff57c 100644 --- a/components/server/src/workspace/garbage-collector.ts +++ b/components/server/src/workspace/garbage-collector.ts @@ -43,7 +43,7 @@ export class WorkspaceGarbageCollector { } public async garbageCollectWorkspacesIfLeader() { - const initialLockDuration = 5 * 60 * 1000; + const initialLockDuration = 5 * 60 * 1000; // 5 minutes try { await this.mutex.client().using(["workspace-gc"], initialLockDuration, async (signal) => { log.info("wsgc: acquired workspace-gc lock. Collecting old workspaces"); From c916410844517ca0c2f5c6da713c8989919c1ea3 Mon Sep 17 00:00:00 2001 From: Milan Pavlik Date: Wed, 26 Apr 2023 08:56:41 +0000 Subject: [PATCH 3/3] fix --- components/server/src/workspace/garbage-collector.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/server/src/workspace/garbage-collector.ts b/components/server/src/workspace/garbage-collector.ts index d16baf866ff57c..88fa796617e428 100644 --- a/components/server/src/workspace/garbage-collector.ts +++ b/components/server/src/workspace/garbage-collector.ts @@ -43,9 +43,9 @@ export class WorkspaceGarbageCollector { } public async garbageCollectWorkspacesIfLeader() { - const initialLockDuration = 5 * 60 * 1000; // 5 minutes + const initialLockDurationMs = this.config.workspaceGarbageCollection.intervalSeconds * 1000; try { - await this.mutex.client().using(["workspace-gc"], initialLockDuration, async (signal) => { + await this.mutex.client().using(["workspace-gc"], initialLockDurationMs, async (signal) => { log.info("wsgc: acquired workspace-gc lock. Collecting old workspaces"); try { await this.softDeleteOldWorkspaces();