move deletion limit on hard deletion (#10353)

This commit is contained in:
Etienne
2025-02-20 11:20:58 +01:00
committed by GitHub
parent 94c0d0f8d2
commit d4aba8d1ff

View File

@ -278,7 +278,8 @@ export class CleanerWorkspaceService {
if (
daysSinceSoftDeleted >
this.inactiveDaysBeforeDelete - this.inactiveDaysBeforeSoftDelete
this.inactiveDaysBeforeDelete - this.inactiveDaysBeforeSoftDelete &&
deletedWorkspacesCount < this.maxNumberOfWorkspacesDeletedPerExecution
) {
this.logger.log(
`${dryRun ? 'DRY RUN - ' : ''}Destroying workspace ${workspace.id} ${workspace.displayName}`,
@ -286,20 +287,16 @@ export class CleanerWorkspaceService {
if (!dryRun) {
await this.workspaceService.deleteWorkspace(workspace.id);
}
deletedWorkspacesCount++;
continue;
}
if (
workspaceInactivity > this.inactiveDaysBeforeSoftDelete &&
deletedWorkspacesCount <=
this.maxNumberOfWorkspacesDeletedPerExecution
) {
if (workspaceInactivity > this.inactiveDaysBeforeSoftDelete) {
await this.informWorkspaceMembersAndSoftDeleteWorkspace(
workspace,
workspaceInactivity,
dryRun,
);
deletedWorkspacesCount++;
continue;
}