Skip to content

Commit dd9df4a

Browse files
committed
added sliding window counter to ratelimitersetup
1 parent 4455db1 commit dd9df4a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/middleware/rateLimiterSetup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Redis from 'ioredis';
22
import { RateLimiterOptions, RateLimiterSelection } from '../@types/rateLimit';
3+
import SlidingWindowCounter from '../rateLimiters/slidingWindowCounter';
34
import TokenBucket from '../rateLimiters/tokenBucket';
45

56
/**
@@ -31,7 +32,7 @@ export default function setupRateLimiter(
3132
throw new Error('Sliding Window Log has not be implemented.');
3233
break;
3334
case 'SLIDING_WINDOW_COUNTER':
34-
throw new Error('Sliding Window Counter algonithm has not be implemented.');
35+
return new SlidingWindowCounter(options.windowSize, options.capacity, client);
3536
break;
3637
default:
3738
// typescript should never let us invoke this function with anything other than the options above

0 commit comments

Comments
 (0)