This commit is contained in:
2025-12-14 10:21:11 +03:30
parent b7e41ff67d
commit 163b4742a0
@@ -20,7 +20,7 @@ export class NotificationQueueService {
async addSmsNotification(job: SmsNotificationQueueJob): Promise<void> {
try {
const jobId = `${job.templateId}-${JSON.stringify(job.parameters)}-${Date.now()}`;
const jobId = `${job.templateId}-${this.generateRandomInt()}-${Date.now()}`;
await this.smsQueue.add('sms-notification', job, {
jobId,
@@ -47,7 +47,7 @@ export class NotificationQueueService {
async addPushNotification(job: PushNotificationQueueJob): Promise<void> {
try {
const jobId = `${job.title}-${JSON.stringify(job.action)}-${Date.now()}`;
const jobId = `${job.title}-${this.generateRandomInt()}-${Date.now()}`;
await this.pushQueue.add('push-notification', job, {
jobId,
@@ -78,7 +78,7 @@ export class NotificationQueueService {
name: 'sms-notification',
data: job,
opts: {
jobId: `${job.templateId}-${JSON.stringify(job.parameters)}-${Date.now()}`,
jobId: `${job.templateId}-${this.generateRandomInt()}`,
attempts: 3,
backoff: {
type: 'exponential',
@@ -101,7 +101,7 @@ export class NotificationQueueService {
name: 'push-notification',
data: job,
opts: {
jobId: `${job.title}-${JSON.stringify(job.action)}-${Date.now()}`,
jobId: `${job.title}-${this.generateRandomInt()}-${Date.now()}`,
attempts: 3,
backoff: {
type: 'exponential',
@@ -139,4 +139,7 @@ export class NotificationQueueService {
throw error;
}
}
private generateRandomInt(): string {
return Math.random().toString(36).substring(2, 15);
}
}