Use >= instead of >
This commit is contained in:
parent
6edbfba7a4
commit
c9afba3c8e
1 changed files with 2 additions and 2 deletions
|
@ -129,10 +129,10 @@ abstract class RateLimiter<User> {
|
||||||
//
|
//
|
||||||
// Otherwise, update the current window.
|
// Otherwise, update the current window.
|
||||||
//
|
//
|
||||||
// We only use `>` (not `>=`), because at this point in the computation,
|
// At this point in the computation,
|
||||||
// we are still only considering whether the *previous* request took the
|
// we are still only considering whether the *previous* request took the
|
||||||
// user over the rate limit.
|
// user over the rate limit.
|
||||||
else if (currentWindow.pointsConsumed > maxPointsPerWindow) {
|
else if (currentWindow.pointsConsumed >= maxPointsPerWindow) {
|
||||||
await sendWindowInformation(req, res, currentWindow);
|
await sendWindowInformation(req, res, currentWindow);
|
||||||
var result = await rejectRequest(req, res, currentWindow, now);
|
var result = await rejectRequest(req, res, currentWindow, now);
|
||||||
if (result != null) return result;
|
if (result != null) return result;
|
||||||
|
|
Loading…
Reference in a new issue