From ccc8b1b56ec5c1f3340dfddd507a37c4d35bfb4d Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Mon, 16 May 2016 19:28:39 +0000 Subject: [PATCH] Iterate just one variable --- node_modules/c9/ratelimit.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/node_modules/c9/ratelimit.js b/node_modules/c9/ratelimit.js index a56f6c3e..0b3cdcd3 100644 --- a/node_modules/c9/ratelimit.js +++ b/node_modules/c9/ratelimit.js @@ -18,9 +18,8 @@ function ratelimit(key, duration, max) { var expireTime = Date.now() - duration; /* Requests are already sorted by date as they are appended, so we just loop until we find one that shouldn't have expired and splice them from the list */ - for (var i = 0; i < requestsForHandle.length; i++) { - if (requestsForHandle[i] >= expireTime) break; - totalToSplice++; + for (totalToSplice = 0; totalToSplice < requestsForHandle.length; totalToSplice++) { + if (requestsForHandle[totalToSplice] >= expireTime) break; } requests[handle].splice(0, totalToSplice); if (requests[handle].length == 0) {