feat(server): improve calendar sync queue (#14783)

This commit is contained in:
DarkSky
2026-04-05 11:02:48 +08:00
parent b98ab495bb
commit 46e7e35357
17 changed files with 354 additions and 300 deletions
@@ -0,0 +1,26 @@
import { Injectable } from '@nestjs/common';
import { OnJob } from '../../base';
import { CalendarService } from './service';
declare global {
interface Jobs {
'calendar.syncSubscription': {
subscriptionId: string;
reason?: 'polling' | 'webhook' | 'on-demand';
};
}
}
@Injectable()
export class CalendarJob {
constructor(private readonly calendar: CalendarService) {}
@OnJob('calendar.syncSubscription')
async syncSubscription({
subscriptionId,
reason,
}: Jobs['calendar.syncSubscription']) {
await this.calendar.syncSubscription(subscriptionId, { reason });
}
}