kopia lustrzana https://github.com/c9/core
Iterate just one variable
rodzic
833f3d1911
commit
ccc8b1b56e
|
@ -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) {
|
||||
|
|
Ładowanie…
Reference in New Issue