Refactored notifications from Check model to NetworkService

This commit is contained in:
Alex Holliday committed 2024-08-14 10:20:35 -07:00
1 parent a6116da278
commit 809e6ee58f
5 files changed
+59 -129

No files matched your search

+3 -3
View File
@@ -16,7 +16,7 @@ class JobQueue {
* @constructor
* @throws {Error}
*/
constructor() {
constructor(networkService) {
this.queue = new Queue(QUEUE_NAME, {
connection,
});
@@ -32,11 +32,11 @@ class JobQueue {
* @returns {Promise<JobQueue>} - Returns a new JobQueue
*
*/
static async createJobQueue(db) {
static async createJobQueue(db, networkService) {
const queue = new JobQueue();
try {
queue.db = db;
queue.networkService = new NetworkService(db);
queue.networkService = networkService;
const monitors = await db.getAllMonitors();
for (const monitor of monitors) {
await queue.addJob(monitor.id, monitor);