Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(backend:files-scheduler): correct ordering of recent files

johavenaea6bcdf7976
diff --git a/backend/src/applications/files/services/files-scheduler.service.ts b/backend/src/applications/files/services/files-scheduler.service.ts
index 8d3570ae..375be590 100644
--- a/backend/src/applications/files/services/files-scheduler.service.ts
+++ b/backend/src/applications/files/services/files-scheduler.service.ts
@@ -124,7 +124,7 @@ export class FilesScheduler {
WHERE ${fk} IS NOT NULL
AND id NOT IN (SELECT id
FROM (SELECT id,
- ROW_NUMBER() OVER (PARTITION BY ${fk} ORDER BY ${filesRecents.mtime}) AS rn
+ ROW_NUMBER() OVER (PARTITION BY ${fk} ORDER BY ${filesRecents.mtime} DESC) AS rn
FROM ${filesRecents}
WHERE ${fk} IS NOT NULL) AS ranked
WHERE ranked.rn <= ${keepNumber})