diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-05-30 10:34:23 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-05-30 10:34:23 +0200 |
| commit | 98cf7958cb42219579fa3b624f41d567b82b5a4e (patch) | |
| tree | 450a8519ad024b7c046afebbde9e3d86190694fc | |
| parent | 506ad32a251f95fd950596a3efb0c595485613b7 (diff) | |
| download | cruncher-98cf7958cb42219579fa3b624f41d567b82b5a4e.tar.gz cruncher-98cf7958cb42219579fa3b624f41d567b82b5a4e.zip | |
add go SLOWMODE :)
| -rw-r--r-- | worker.js | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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 |
