fix(storage): clean terminal download items
This commit is contained in:
1 parent
b9d988b379
commit
15ee841d0c
3 files changed
+11
-2
No files matched your search
Vendored
+1
-1
@@ -14843,7 +14843,7 @@ router5.post("/maintenance/download-items/cleanup", requireAuth, async (req, res
|
||||
const retentionDays = Math.min(365, Math.max(1, parseInt(String(req.body?.retentionDays ?? "7"), 10) || 7));
|
||||
const result = await query(
|
||||
`DELETE FROM telegram_download_items
|
||||
WHERE status = 'completed'
|
||||
WHERE status IN ('success', 'failed', 'skipped')
|
||||
AND COALESCE(completed_at, updated_at, created_at) < NOW() - ($1::int * INTERVAL '1 day')`,
|
||||
[retentionDays]
|
||||
);
|
||||
|
||||
@@ -213,7 +213,7 @@ router.post('/maintenance/download-items/cleanup', requireAuth, async (req: Requ
|
||||
const retentionDays = Math.min(365, Math.max(1, parseInt(String(req.body?.retentionDays ?? '7'), 10) || 7));
|
||||
const result = await query(
|
||||
`DELETE FROM telegram_download_items
|
||||
WHERE status = 'completed'
|
||||
WHERE status IN ('success', 'failed', 'skipped')
|
||||
AND COALESCE(completed_at, updated_at, created_at) < NOW() - ($1::int * INTERVAL '1 day')`,
|
||||
[retentionDays]
|
||||
);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
|
||||
const source = fs.readFileSync(new URL('./storage.ts', import.meta.url), 'utf8');
|
||||
|
||||
assert.match(source, /status\s+IN\s*\(\s*'success'\s*,\s*'failed'\s*,\s*'skipped'\s*\)/);
|
||||
assert.doesNotMatch(source, /status\s*=\s*'completed'/);
|
||||
|
||||
console.log('storage maintenance download item cleanup statuses ok');
|
||||
Reference in new issue
Block a user