Ensure only one active attachment download setTimeout
This commit is contained in:
parent
ab2cc6ee53
commit
cc4886caa5
1 changed files with 5 additions and 0 deletions
|
@ -110,6 +110,11 @@ async function addJob(attachment, job = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _tick() {
|
async function _tick() {
|
||||||
|
if (timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = null;
|
||||||
|
}
|
||||||
|
|
||||||
_maybeStartJob();
|
_maybeStartJob();
|
||||||
timeout = setTimeout(_tick, TICK_INTERVAL);
|
timeout = setTimeout(_tick, TICK_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue