From cc4886caa58f125b64d8e60eec30bdf211a95b80 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 24 Jun 2019 13:39:37 -0700 Subject: [PATCH] Ensure only one active attachment download setTimeout --- js/modules/attachment_downloads.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/modules/attachment_downloads.js b/js/modules/attachment_downloads.js index 955b06d7f..ad43eecaa 100644 --- a/js/modules/attachment_downloads.js +++ b/js/modules/attachment_downloads.js @@ -110,6 +110,11 @@ async function addJob(attachment, job = {}) { } async function _tick() { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + _maybeStartJob(); timeout = setTimeout(_tick, TICK_INTERVAL); }