Skip to content

Commit

Permalink
moved heartbeat from controller to queue consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
f-w committed Dec 4, 2024
1 parent 93a2bdb commit bf40da2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/api/notifications/notifications.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,16 +458,6 @@ export class NotificationsController {
},
this.req,
);
const hbTimeout = setInterval(() => {
this.notificationsService.updateById(
data.id,
{
updated: new Date(),
},
this.req,
);
}, 60000);

const count = subCandidates.length;
const chunks = Math.ceil(count / this.broadcastSubscriberChunkSize);
let i = 0;
Expand All @@ -489,7 +479,6 @@ export class NotificationsController {
data: { id: data.id },
children,
});
clearTimeout(hbTimeout);
break;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/queue/notification-queue-consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ export class NotificationQueueConsumer
case 'p':
return this.postBroadcastProcessing(notification);
case 'c':
await this.notificationsService.updateById(notification.id, {
updated: new Date(),
});
return this.broadcastToSubscriberChunk(notification, job);
}
}
Expand Down

0 comments on commit bf40da2

Please sign in to comment.