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:
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;
I'm getting a negative number for expiration causing my redis client to come back with this error:
Line 105 uses this:
where my ex is
1441268386and Date.now() was1441268386507meaning 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 shownremaining 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?