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 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 132x | import { Injectable, OnModuleDestroy, Optional } from '@nestjs/common';
import { InjectQueue } from '@nestjs/bullmq';
import { Queue } from 'bullmq';
@Injectable()
export class BullShutdownService implements OnModuleDestroy {
constructor(
@Optional() @InjectQueue('listingIndex') private readonly listingIndex?: Queue,
@Optional() @InjectQueue('media') private readonly media?: Queue,
@Optional() @InjectQueue('media-gc') private readonly mediaGc?: Queue,
@Optional() @InjectQueue('boost-expiry') private readonly boostExpiry?: Queue,
@Optional() @InjectQueue('quick-rent:match') private readonly qrMatch?: Queue,
@Optional() @InjectQueue('quick-rent:end-bid-window') private readonly qrEnd?: Queue,
@Optional() @InjectQueue('quick-rent:collect-payment') private readonly qrPay?: Queue,
@Optional() @InjectQueue('quick-rent:reminders') private readonly qrRemind?: Queue,
@Optional() @InjectQueue('quick-rent:payment-window-expired') private readonly qrExpired?: Queue,
@Optional() @InjectQueue('notifications') private readonly notifications?: Queue,
@Optional() @InjectQueue('analytics:daily') private readonly analyticsDaily?: Queue,
@Optional() @InjectQueue('billing:dunning') private readonly billingDunning?: Queue,
) {}
async onModuleDestroy() {
const queues = [
this.listingIndex,
this.media,
this.mediaGc,
this.boostExpiry,
this.qrMatch,
this.qrEnd,
this.qrPay,
this.qrRemind,
this.qrExpired,
this.notifications,
this.analyticsDaily,
this.billingDunning,
].filter(Boolean) as Queue[];
await Promise.all(
queues.map(async (q) => {
try { await q.close(); } catch { /* ignore */ }
}),
);
}
}
|