From 942a89845b94ed1d64518b935ad11dbe5eacaebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Fri, 8 Nov 2024 14:59:20 +0000 Subject: [PATCH] Log edge case for `updateDeletionEligibilityTime` --- .../server/src/workspace/workspace-service.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/server/src/workspace/workspace-service.ts b/components/server/src/workspace/workspace-service.ts index defd384e1f3c33..11096aebae1996 100644 --- a/components/server/src/workspace/workspace-service.ts +++ b/components/server/src/workspace/workspace-service.ts @@ -538,6 +538,14 @@ export class WorkspaceService { const lastActive = instance?.stoppingTime || instance?.startedTime || instance?.creationTime || workspace?.creationTime; if (!lastActive && !activeNow) { + log.warn( + { userId, workspaceId }, + "[updateDeletionEligibilityTime] No last active time found, skipping update of deletion eligibility time", + { + workspace, + instance, + }, + ); return; } const deletionEligibilityTime = activeNow ? new Date() : new Date(lastActive); @@ -567,7 +575,7 @@ export class WorkspaceService { ) { log.warn( { userId, workspaceId, instanceId: instance?.id }, - "Prevented moving deletion eligibility time backwards", + "[updateDeletionEligibilityTime] Prevented moving deletion eligibility time backwards", { hasGitChanges, timestamps: new TrustedValue({ @@ -587,7 +595,11 @@ export class WorkspaceService { deletionEligibilityTime: deletionEligibilityTime.toISOString(), }); } catch (error) { - log.error({ userId, workspaceId }, "Failed to update deletion eligibility time", error); + log.error( + { userId, workspaceId }, + "[updateDeletionEligibilityTime] Failed to update deletion eligibility time", + error, + ); } }