Skip to content

Commit

Permalink
Log edge case for updateDeletionEligibilityTime (#20354)
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek authored Nov 8, 2024
1 parent aeaec34 commit 8e7678a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions components/server/src/workspace/workspace-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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({
Expand All @@ -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,
);
}
}

Expand Down

0 comments on commit 8e7678a

Please sign in to comment.