Stop automatically cleaning up events

This commit is contained in:
Alex Gleason 2023-12-26 16:38:21 -06:00
parent e5e737faae
commit 59b9593191
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 0 additions and 16 deletions

View File

@ -1,22 +1,9 @@
import * as eventsDB from '@/db/events.ts';
import { deleteUnattachedMediaByUrl, getUnattachedMedia } from '@/db/unattached-media.ts';
import { cron } from '@/deps.ts';
import { Time } from '@/utils/time.ts';
import { configUploader as uploader } from '@/uploaders/config.ts';
import { cidFromUrl } from '@/utils/ipfs.ts';
/** Clean up old remote events. */
async function cleanupEvents() {
console.log('Cleaning up old remote events...');
const [result] = await eventsDB.deleteFilters([{
until: Math.floor((Date.now() - Time.days(7)) / 1000),
local: false,
}]);
console.log(`Cleaned up ${result?.numDeletedRows ?? 0} old remote events.`);
}
/** Delete files that aren't attached to any events. */
async function cleanupMedia() {
console.log('Deleting orphaned media files...');
@ -38,8 +25,5 @@ async function cleanupMedia() {
console.log(`Removed ${media?.length ?? 0} orphaned media files.`);
}
await cleanupEvents();
await cleanupMedia();
cron.every15Minute(cleanupEvents);
cron.every15Minute(cleanupMedia);