Iterate just one variable

pull/306/head
Tim Robinson 2016-05-16 19:28:39 +00:00
rodzic 833f3d1911
commit ccc8b1b56e
1 zmienionych plików z 2 dodań i 3 usunięć

5
node_modules/c9/ratelimit.js wygenerowano vendored
Wyświetl plik

@ -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) {