Stop automatically cleaning up events
This commit is contained in:
parent
e5e737faae
commit
59b9593191
16
src/cron.ts
16
src/cron.ts
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue