Skip to content

Commit 46b6d1a

Browse files
committed
spec updates
1 parent 89277fd commit 46b6d1a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/rateLimiters/slidingWindowCounter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import { RateLimiter, RateLimiterResponse, RedisWindow } from '../@types/rateLim
99
* takeup in each.
1010
*
1111
* Whenever a user makes a request the following steps are performed:
12-
* 1. Fixed minute windows are defined along with redis caches if previously undefined.
13-
* 2. Rolling minute windows are defined or updated based on the timestamp of the new request.
12+
* 1. Fixed windows are defined along with redis caches if previously undefined.
13+
* 2. Rolling windows are defined or updated based on the timestamp of the new request.
1414
* 3. Counter of the current fixed window is updated with the new request's token usage.
1515
* 4. If a new minute interval is reached, the averaging formula is run to prevent fixed window's flaw
1616
* of flooded requests around window borders
17-
* (ex. 10 token capacity: 1m59s 10 reqs 2m2s 10 reqs)
17+
* (ex. 1m windows, 10 token capacity: 1m59s 10 reqs 2m2s 10 reqs)
1818
*/
1919
class SlidingWindowCounter implements RateLimiter {
2020
private windowSize: number;
@@ -24,7 +24,7 @@ class SlidingWindowCounter implements RateLimiter {
2424
private client: Redis;
2525

2626
/**
27-
* Create a new instance of a TokenBucket rate limiter that can be connected to any database store
27+
* Create a new instance of a SlidingWindowCounter rate limiter that can be connected to any database store
2828
* @param windowSize size of each window in milliseconds (fixed and rolling)
2929
* @param capacity max capacity of tokens allowed per fixed window
3030
* @param client redis client where rate limiter will cache information

0 commit comments

Comments
 (0)