nullcheck and dotenv
This commit is contained in:
1 parent
bce6755a61
commit
060fa31f2f
1 file changed
+3
-3
+3
-3
@@ -2,7 +2,7 @@
|
|||||||
const { exec } = require("child_process");
|
const { exec } = require("child_process");
|
||||||
const { MongoClient } = require("mongodb");
|
const { MongoClient } = require("mongodb");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
require("dotenv").config({ path: path.join(__dirname, "..", ".env") });
|
require("dotenv").config();
|
||||||
|
|
||||||
// ========================
|
// ========================
|
||||||
// CONFIG
|
// CONFIG
|
||||||
@@ -84,10 +84,10 @@ async function main() {
|
|||||||
{ sort: { created_at: 1 }, returnDocument: "after" }
|
{ sort: { created_at: 1 }, returnDocument: "after" }
|
||||||
);
|
);
|
||||||
|
|
||||||
if (job.value) {
|
if (job && job.value) {
|
||||||
await runJob(job.value);
|
await runJob(job.value);
|
||||||
} else {
|
} else {
|
||||||
// Wait 1 second before checking again
|
// Queue empty, wait 1 second
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user