Ensure only one active attachment download setTimeout
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user