Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 12x 12x 12x 12x 12x 1x 12x 1x | import { Injectable } from '@nestjs/common';
import { Cron, CronExpression } from '@nestjs/schedule';
import { InjectQueue } from '@nestjs/bullmq';
import { Queue } from 'bullmq';
@Injectable()
export class MediaGcScheduler {
constructor(@InjectQueue('media-gc') private readonly gcQueue: Queue) {}
// Run every day at 03:00 UTC
@Cron(CronExpression.EVERY_DAY_AT_2AM)
async enqueueGc() {
await this.gcQueue.add('gc', {}, {
jobId: `media-gc-${Date.now()}`,
removeOnComplete: true,
removeOnFail: true,
});
}
} |