summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--worker.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/worker.js b/worker.js
index 0934392..54988d9 100644
--- a/worker.js
+++ b/worker.js
@@ -26,7 +26,9 @@ const RABBITMQ_URI = process.env.RABBITMQ_URI,
MAXCONNS = parseInt(process.env.MAXCONNS) || 3,
// number of participants to calculate at once
BATCHSIZE = parseInt(process.env.BATCHSIZE) || 1000,
- LOAD_TIMEOUT = parseInt(process.env.LOAD_TIMEOUT) || 5; // s
+ LOAD_TIMEOUT = parseInt(process.env.LOAD_TIMEOUT) || 5, // s
+ // wait time before next batch
+ SLOWMODE = parseInt(process.env.SLOWMODE) || 0; // s
const logger = new (winston.Logger)({
transports: [
@@ -137,6 +139,10 @@ if (LOGGLY_TOKEN)
type: seq.QueryTypes.UPSERT
});
+ if (SLOWMODE > 0) {
+ logger.info("slowmode active, sleeping…", { wait: SLOWMODE });
+ await sleep(SLOWMODE * 1000);
+ }
// ack
await Promise.map(msgs, async (m) => await ch.ack(m));
// notify web