mirror of
https://github.com/immich-app/immich.git
synced 2025-12-24 01:11:32 +03:00
fix: make sure backups are correctly sorted for clean up
This commit is contained in:
@@ -56,7 +56,10 @@ export class BackupService extends BaseService {
|
|||||||
|
|
||||||
const backupsFolder = StorageCore.getBaseFolder(StorageFolder.Backups);
|
const backupsFolder = StorageCore.getBaseFolder(StorageFolder.Backups);
|
||||||
const files = await this.storageRepository.readdir(backupsFolder);
|
const files = await this.storageRepository.readdir(backupsFolder);
|
||||||
const backups = files.filter((fn) => isValidRoutineBackupName(fn));
|
const backups = files
|
||||||
|
.filter((fn) => isValidRoutineBackupName(fn))
|
||||||
|
.toSorted()
|
||||||
|
.toReversed();
|
||||||
const failedBackups = files.filter((fn) => isFailedBackupName(fn));
|
const failedBackups = files.filter((fn) => isFailedBackupName(fn));
|
||||||
|
|
||||||
const toDelete = backups.slice(config.keepLastAmount);
|
const toDelete = backups.slice(config.keepLastAmount);
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ describe(MaintenanceService.name, () => {
|
|||||||
'immich-db-backup-20250727T110116-v1.234.5-pg14.5.sql.gz',
|
'immich-db-backup-20250727T110116-v1.234.5-pg14.5.sql.gz',
|
||||||
'immich-db-backup-1753789649000.sql.gz',
|
'immich-db-backup-1753789649000.sql.gz',
|
||||||
],
|
],
|
||||||
failedBackups: ['immich-db-backup-20250725T110216-v1.234.5-pg14.5.sql.gz.tmp'],
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user