bug
This commit is contained in:
@@ -20,7 +20,7 @@ export class NotificationQueueService {
|
|||||||
|
|
||||||
async addSmsNotification(job: SmsNotificationQueueJob): Promise<void> {
|
async addSmsNotification(job: SmsNotificationQueueJob): Promise<void> {
|
||||||
try {
|
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, {
|
await this.smsQueue.add('sms-notification', job, {
|
||||||
jobId,
|
jobId,
|
||||||
@@ -47,7 +47,7 @@ export class NotificationQueueService {
|
|||||||
|
|
||||||
async addPushNotification(job: PushNotificationQueueJob): Promise<void> {
|
async addPushNotification(job: PushNotificationQueueJob): Promise<void> {
|
||||||
try {
|
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, {
|
await this.pushQueue.add('push-notification', job, {
|
||||||
jobId,
|
jobId,
|
||||||
@@ -78,7 +78,7 @@ export class NotificationQueueService {
|
|||||||
name: 'sms-notification',
|
name: 'sms-notification',
|
||||||
data: job,
|
data: job,
|
||||||
opts: {
|
opts: {
|
||||||
jobId: `${job.templateId}-${JSON.stringify(job.parameters)}-${Date.now()}`,
|
jobId: `${job.templateId}-${this.generateRandomInt()}`,
|
||||||
attempts: 3,
|
attempts: 3,
|
||||||
backoff: {
|
backoff: {
|
||||||
type: 'exponential',
|
type: 'exponential',
|
||||||
@@ -101,7 +101,7 @@ export class NotificationQueueService {
|
|||||||
name: 'push-notification',
|
name: 'push-notification',
|
||||||
data: job,
|
data: job,
|
||||||
opts: {
|
opts: {
|
||||||
jobId: `${job.title}-${JSON.stringify(job.action)}-${Date.now()}`,
|
jobId: `${job.title}-${this.generateRandomInt()}-${Date.now()}`,
|
||||||
attempts: 3,
|
attempts: 3,
|
||||||
backoff: {
|
backoff: {
|
||||||
type: 'exponential',
|
type: 'exponential',
|
||||||
@@ -139,4 +139,7 @@ export class NotificationQueueService {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private generateRandomInt(): string {
|
||||||
|
return Math.random().toString(36).substring(2, 15);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user