@@ -119,6 +119,12 @@ export class NotificationQueueService {
|
||||
}
|
||||
async addBulkInAppNotifications(jobs: InAppNotificationQueueJob[]): Promise<void> {
|
||||
try {
|
||||
this.logger.log(
|
||||
`[addBulkInAppNotifications] queueing ${jobs.length} job(s): ${jobs
|
||||
.map(j => `admin=${j.recipient.adminId} rest=${j.recipient.restaurantId} notif=${j.notificationId}`)
|
||||
.join(' | ')}`,
|
||||
);
|
||||
|
||||
const queueJobs = jobs.map(job => ({
|
||||
name: 'in-app-notification',
|
||||
data: job,
|
||||
@@ -132,10 +138,12 @@ export class NotificationQueueService {
|
||||
},
|
||||
}));
|
||||
|
||||
await this.inAppQueue.addBulk(queueJobs);
|
||||
this.logger.log(`Added ${jobs.length} InApp notification jobs to queue`);
|
||||
const added = await this.inAppQueue.addBulk(queueJobs);
|
||||
this.logger.log(
|
||||
`[addBulkInAppNotifications] added ${added.length} job(s) to queue "${NotificationQueueNameEnum.IN_APP}": ids=${added.map(j => j.id).join(', ')}`,
|
||||
);
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to add bulk notifications to queue:`, error);
|
||||
this.logger.error(`[addBulkInAppNotifications] failed to add jobs to queue:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user