mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Stop automatically cleaning up events
This commit is contained in:
parent
e5e737faae
commit
59b9593191
1 changed files with 0 additions and 16 deletions
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 { deleteUnattachedMediaByUrl, getUnattachedMedia } from '@/db/unattached-media.ts';
|
||||||
import { cron } from '@/deps.ts';
|
import { cron } from '@/deps.ts';
|
||||||
import { Time } from '@/utils/time.ts';
|
import { Time } from '@/utils/time.ts';
|
||||||
import { configUploader as uploader } from '@/uploaders/config.ts';
|
import { configUploader as uploader } from '@/uploaders/config.ts';
|
||||||
import { cidFromUrl } from '@/utils/ipfs.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. */
|
/** Delete files that aren't attached to any events. */
|
||||||
async function cleanupMedia() {
|
async function cleanupMedia() {
|
||||||
console.log('Deleting orphaned media files...');
|
console.log('Deleting orphaned media files...');
|
||||||
|
|
@ -38,8 +25,5 @@ async function cleanupMedia() {
|
||||||
console.log(`Removed ${media?.length ?? 0} orphaned media files.`);
|
console.log(`Removed ${media?.length ?? 0} orphaned media files.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await cleanupEvents();
|
|
||||||
await cleanupMedia();
|
await cleanupMedia();
|
||||||
|
|
||||||
cron.every15Minute(cleanupEvents);
|
|
||||||
cron.every15Minute(cleanupMedia);
|
cron.every15Minute(cleanupMedia);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue