Skip to content

Commit 39065c7

Browse files
committed
More prevention logging
1 parent 13e1a76 commit 39065c7

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -553,17 +553,25 @@ export class WorkspaceService {
553553
return;
554554
}
555555
// workspaces with pending changes live twice as long
556-
if (
557-
(instance?.gitStatus?.totalUncommitedFiles || 0) > 0 ||
558-
(instance?.gitStatus?.totalUnpushedCommits || 0) > 0 ||
559-
(instance?.gitStatus?.totalUntrackedFiles || 0) > 0
560-
) {
556+
const hasGitChanges =
557+
instance?.gitStatus?.totalUncommitedFiles ||
558+
0 > 0 ||
559+
instance?.gitStatus?.totalUnpushedCommits ||
560+
0 > 0 ||
561+
instance?.gitStatus?.totalUntrackedFiles ||
562+
0 > 0;
563+
if (hasGitChanges) {
561564
daysToLive = daysToLive * 2;
562565
}
563566
deletionEligibilityTime.setDate(deletionEligibilityTime.getDate() + daysToLive);
564-
if (new Date() > deletionEligibilityTime) {
565-
log.warn({ userId, workspaceId }, "Prevented setting deletion eligibility time in the past", {
567+
if (
568+
workspace.deletionEligibilityTime &&
569+
workspace.deletionEligibilityTime > deletionEligibilityTime.toISOString()
570+
) {
571+
log.warn({ userId, workspaceId }, "Prevented moving deletion eligibility time backwards", {
566572
deletionEligibilityTime: deletionEligibilityTime.toISOString(),
573+
hasGitChanges,
574+
lastActive,
567575
});
568576
return;
569577
}

0 commit comments

Comments
 (0)