-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Description
I'm getting a negative number for expiration causing my redis client to come back with this error:
[ [Error: ERR invalid expire time in SETEX] ]
Line 105 uses this:
ex * 1000 - Date.now()
where my ex is 1441268386 and Date.now() was 1441268386507 meaning it was -507ms over expiration.
The problem here is that error is in a weird double array so the error check doesn't catch it and my responses to limit.get(function(err, limit) { ... }); always show n remaining so it effectively doesn't rate limit at all.
I assume other people would have run into this. I was using a duration of 1 second and I'm hitting redis pretty hard concurrently.
Is this line stripping off the milliseconds and just making it accurate to the second?
var ex = (Date.now() + duration) / 1000 | 0;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels