diff options
author | Graeme Yeates <yeatesgraeme@gmail.com> | 2017-07-24 11:04:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-24 11:04:12 -0400 |
commit | fa206affed3a13261c4fb4b314a5bf0df8e50308 (patch) | |
tree | 7a6db387d491aae47d3771eaaf093dfc00299ade | |
parent | 3c69b36c6f27ad281ea81c20d876250b010f7e3c (diff) | |
parent | 6b63c2eda5be34fa157431d5e3bfae721f1bdb4d (diff) | |
download | async-fa206affed3a13261c4fb4b314a5bf0df8e50308.tar.gz |
Merge pull request #1454 from iamdoron/master
Use shift instead of splice (when possible) in queue
-rw-r--r-- | lib/internal/queue.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/internal/queue.js b/lib/internal/queue.js index 4f57edb..1a3f4cb 100644 --- a/lib/internal/queue.js +++ b/lib/internal/queue.js @@ -65,7 +65,9 @@ export default function queue(worker, concurrency, payload) { var task = tasks[i]; var index = indexOf(workersList, task, 0); - if (index >= 0) { + if (index === 0) { + workersList.shift(); + } else if (index > 0) { workersList.splice(index, 1); } |