From 59b00d7969bb5ead351ba3875dc2ce40fde9c122 Mon Sep 17 00:00:00 2001 From: Marco Wettstein Date: Mon, 26 Apr 2021 22:02:10 +0200 Subject: [PATCH] fix: temporary mongodb outages stop job-queue forever hopefully fixes https://github.com/msavin/SteveJobs/issues/92 --- package/server/imports/operator/queue/index.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/package/server/imports/operator/queue/index.js b/package/server/imports/operator/queue/index.js index 50c65ef..8eaf70a 100755 --- a/package/server/imports/operator/queue/index.js +++ b/package/server/imports/operator/queue/index.js @@ -49,11 +49,17 @@ queue.prototype.trigger = function () { var self = this; if (self.available === true && self.interval) { - self.available = false; + try { + self.available = false; - if (dominator.isActive()) { - self.run() - } else { + if (dominator.isActive()) { + self.run() + } else { + self.available = true; + } + } catch(e) { + console.error(e); + } finally { self.available = true; } } @@ -114,4 +120,4 @@ queue.prototype.run = function () { } } -export { queue } \ No newline at end of file +export { queue }