Skip to content

Commit 531caad

Browse files
committed
fix(submit): Added configuration ENV option EENGINE_SUBMIT_DELAY / --submitDelay=duration argument to allow rate limiting message sending (this is global, not account specific)
1 parent 1f2a0e6 commit 531caad

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

workers/submit.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const EENGINE_TIMEOUT = getDuration(readEnvValue('EENGINE_TIMEOUT') || config.se
6060

6161
const SUBMIT_QC = (readEnvValue('EENGINE_SUBMIT_QC') && Number(readEnvValue('EENGINE_SUBMIT_QC'))) || config.queues.submit || 1;
6262

63+
const SUBMIT_DELAY = getDuration(readEnvValue('EENGINE_SUBMIT_DELAY') || config.submitDelay) || null;
64+
6365
let callQueue = new Map();
6466
let mids = 0;
6567

@@ -325,7 +327,14 @@ const submitWorker = new Worker(
325327
},
326328
Object.assign(
327329
{
328-
concurrency: SUBMIT_QC
330+
concurrency: SUBMIT_QC,
331+
332+
limiter: SUBMIT_DELAY
333+
? {
334+
max: 1,
335+
duration: SUBMIT_DELAY
336+
}
337+
: null
329338
},
330339
queueConf
331340
)

0 commit comments

Comments
 (0)