From 060fa31f2fcb9a0f9cf9bc47cc142d046ec82b37 Mon Sep 17 00:00:00 2001 From: DeSqBlocki Date: Sat, 6 Dec 2025 13:58:48 +0100 Subject: [PATCH] nullcheck and dotenv --- queue_worker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/queue_worker.js b/queue_worker.js index b7a8418..b8f9979 100644 --- a/queue_worker.js +++ b/queue_worker.js @@ -2,7 +2,7 @@ const { exec } = require("child_process"); const { MongoClient } = require("mongodb"); const path = require("path"); -require("dotenv").config({ path: path.join(__dirname, "..", ".env") }); +require("dotenv").config(); // ======================== // CONFIG @@ -84,10 +84,10 @@ async function main() { { sort: { created_at: 1 }, returnDocument: "after" } ); - if (job.value) { + if (job && job.value) { await runJob(job.value); } else { - // Wait 1 second before checking again + // Queue empty, wait 1 second await new Promise((resolve) => setTimeout(resolve, 1000)); } }