@@ -26,7 +26,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
26
26
storeClient : redisMockClient ,
27
27
points : 2 ,
28
28
duration : 5 ,
29
- useIoredis : true ,
30
29
} ) ;
31
30
rateLimiter
32
31
. consume ( testKey )
@@ -47,7 +46,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
47
46
storeClient : redisMockClient ,
48
47
points : 1 ,
49
48
duration : 5 ,
50
- useIoredis : true ,
51
49
} ) ;
52
50
rateLimiter
53
51
. consume ( testKey , 2 )
@@ -65,7 +63,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
65
63
points : 2 ,
66
64
duration : 5 ,
67
65
execEvenly : true ,
68
- useIoredis : true ,
69
66
} ) ;
70
67
rateLimiter
71
68
. consume ( testKey )
@@ -102,7 +99,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
102
99
duration : 1 ,
103
100
execEvenly : true ,
104
101
execEvenlyMinDelayMs : 20 ,
105
- useIoredis : true ,
106
102
} ) ;
107
103
rateLimiter
108
104
. consume ( testKey )
@@ -129,7 +125,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
129
125
storeClient : redisMockClient ,
130
126
points : 3 ,
131
127
duration : 5 ,
132
- useIoredis : true
133
128
} ) ;
134
129
rateLimiter
135
130
. consume ( testKey )
@@ -157,7 +152,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
157
152
storeClient : redisMockClient ,
158
153
points : 1 ,
159
154
duration : 5 ,
160
- useIoredis : true
161
155
} ) ;
162
156
rateLimiter
163
157
. consume ( testKey )
@@ -187,7 +181,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
187
181
duration : 5 ,
188
182
inMemoryBlockOnConsumed : 2 ,
189
183
inMemoryBlockDuration : 10 ,
190
- useIoredis : true
191
184
} ) ;
192
185
rateLimiter
193
186
. consume ( testKey )
@@ -213,7 +206,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
213
206
points : 1 ,
214
207
duration : 5 ,
215
208
inMemoryBlockOnConsumed : 1 ,
216
- useIoredis : true
217
209
} ) ;
218
210
rateLimiter
219
211
. consume ( testKey )
@@ -233,7 +225,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
233
225
points : 1 ,
234
226
duration : 5 ,
235
227
inMemoryBlockOnConsumed : 1 ,
236
- useIoredis : true
237
228
} ) ;
238
229
rateLimiter
239
230
. consume ( testKey , 2 )
@@ -254,7 +245,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
254
245
duration : 1 ,
255
246
inMemoryBlockOnConsumed : 2 ,
256
247
inMemoryBlockDuration : 2 ,
257
- useIoredis : true
258
248
} ) ;
259
249
// It blocks on the first consume as consumed points more than available
260
250
rateLimiter
@@ -281,7 +271,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
281
271
const rateLimiter = new RateLimiterRedis ( {
282
272
storeClient : redisMockClient ,
283
273
inMemoryBlockDuration : 2 ,
284
- useIoredis : true
285
274
} ) ;
286
275
rateLimiter . reward ( 'test' ) ;
287
276
} catch ( err ) {
@@ -309,7 +298,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
309
298
310
299
const rateLimiter = new RateLimiterRedis ( {
311
300
storeClient : redisMockClient ,
312
- useIoredis : true
313
301
} ) ;
314
302
315
303
await redisMockClient . disconnect ( ) ;
@@ -335,9 +323,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
335
323
points : 2 ,
336
324
duration : 2 ,
337
325
storeClient : redisMockClient ,
338
- useIoredis : true
339
326
} ) ,
340
- useIoredis : true
341
327
} ) ;
342
328
await redisClientClosed . disconnect ( ) ;
343
329
@@ -362,9 +348,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
362
348
points : 2 ,
363
349
duration : 2 ,
364
350
storeClient : redisMockClient ,
365
- useIoredis : true
366
351
} ) ,
367
- useIoredis : true
368
352
} ) ;
369
353
await redisClientClosed . disconnect ( ) ;
370
354
@@ -388,9 +372,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
388
372
points : 2 ,
389
373
duration : 2 ,
390
374
storeClient : redisMockClient ,
391
- useIoredis : true
392
375
} ) ,
393
- useIoredis : true
394
376
} ) ;
395
377
await redisClientClosed . disconnect ( ) ;
396
378
@@ -420,9 +402,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
420
402
points : 1 ,
421
403
duration : 1 ,
422
404
storeClient : redisMockClient ,
423
- useIoredis : true
424
405
} ) ,
425
- useIoredis : true
426
406
} ) ;
427
407
await redisClientClosed . disconnect ( ) ;
428
408
@@ -436,7 +416,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
436
416
it ( 'use keyPrefix from options' , ( ) => {
437
417
const testKey = 'key' ;
438
418
const keyPrefix = 'test' ;
439
- const rateLimiter = new RateLimiterRedis ( { keyPrefix, storeClient : redisMockClient , useIoredis : true } ) ;
419
+ const rateLimiter = new RateLimiterRedis ( { keyPrefix, storeClient : redisMockClient } ) ;
440
420
441
421
expect ( rateLimiter . getKey ( testKey ) ) . to . equal ( 'test:key' ) ;
442
422
} ) ;
@@ -448,7 +428,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
448
428
points : 1 ,
449
429
duration : 1 ,
450
430
blockDuration : 2 ,
451
- useIoredis : true
452
431
} ) ;
453
432
rateLimiter
454
433
. consume ( testKey , 2 )
@@ -468,7 +447,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
468
447
points : 1 ,
469
448
duration : 1 ,
470
449
blockDuration : 2 ,
471
- useIoredis : true
472
450
} ) ;
473
451
sinon . stub ( rateLimiter , '_block' ) . callsFake ( ( ) => Promise . reject ( new Error ( ) ) ) ;
474
452
rateLimiter
@@ -489,7 +467,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
489
467
points : 1 ,
490
468
duration : 1 ,
491
469
blockDuration : 2 ,
492
- useIoredis : true
493
470
} ) ;
494
471
rateLimiter
495
472
. consume ( testKey , 2 )
@@ -517,7 +494,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
517
494
storeClient : redisMockClient ,
518
495
points : 1 ,
519
496
duration : 1 ,
520
- useIoredis : true
521
497
} ) ;
522
498
rateLimiter . block ( testKey , 2 ) . then ( ( ) => {
523
499
rateLimiter
@@ -539,7 +515,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
539
515
storeClient : redisMockClient ,
540
516
points : 2 ,
541
517
duration : 1 ,
542
- useIoredis : true
543
518
} ) ;
544
519
rateLimiter
545
520
. consume ( testKey )
@@ -567,7 +542,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
567
542
storeClient : redisMockClient ,
568
543
points : 2 ,
569
544
duration : 1 ,
570
- useIoredis : true
571
545
} ) ;
572
546
await redisMockClient . disconnect ( )
573
547
await rateLimiter
@@ -628,7 +602,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
628
602
storeClient : redisMockClient ,
629
603
points : 2 ,
630
604
duration : 1 ,
631
- useIoredis : true
632
605
} ) ;
633
606
rateLimiter
634
607
. get ( testKey )
@@ -648,7 +621,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
648
621
storeClient : redisMockClient ,
649
622
points : 2 ,
650
623
duration : 1 ,
651
- useIoredis : true
652
624
} ) ;
653
625
rateLimiter
654
626
. consume ( testKey )
@@ -668,7 +640,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
668
640
storeClient : redisMockClient ,
669
641
points : 2 ,
670
642
duration : 1 ,
671
- useIoredis : true
672
643
} ) ;
673
644
rateLimiter . delete ( testKey )
674
645
. then ( ( resDel ) => {
@@ -684,7 +655,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
684
655
storeClient : redisMockClient ,
685
656
points : 2 ,
686
657
duration : 1 ,
687
- useIoredis : true
688
658
} ) ;
689
659
await redisMockClient . disconnect ( ) ;
690
660
await rateLimiter . delete ( testKey )
@@ -698,7 +668,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
698
668
storeClient : redisMockClient ,
699
669
points : 2 ,
700
670
duration : 5 ,
701
- useIoredis : true
702
671
} ) ;
703
672
rateLimiter
704
673
. consume ( testKey , 1 , { customDuration : 1 } )
@@ -717,7 +686,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
717
686
storeClient : redisMockClient ,
718
687
points : 2 ,
719
688
duration : 5 ,
720
- useIoredis : true
721
689
} ) ;
722
690
rateLimiter
723
691
. consume ( testKey , 1 , { customDuration : 1 } )
@@ -743,9 +711,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
743
711
points : 2 ,
744
712
duration : 3 ,
745
713
storeClient : redisMockClient ,
746
- useIoredis : true
747
714
} ) ,
748
- useIoredis : true
749
715
} ) ;
750
716
await redisClientClosed . disconnect ( ) ;
751
717
@@ -766,7 +732,6 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
766
732
blockDuration : 10 ,
767
733
inMemoryBlockOnConsumed : 2 ,
768
734
inMemoryBlockDuration : 10 ,
769
- useIoredis : true
770
735
} ) ;
771
736
rateLimiter
772
737
. consume ( testKey )
@@ -791,7 +756,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
791
756
792
757
it ( 'does not expire key if duration set to 0' , ( done ) => {
793
758
const testKey = 'neverexpire' ;
794
- const rateLimiter = new RateLimiterRedis ( { storeClient : redisMockClient , points : 2 , duration : 0 , useIoredis : true } ) ;
759
+ const rateLimiter = new RateLimiterRedis ( { storeClient : redisMockClient , points : 2 , duration : 0 } ) ;
795
760
rateLimiter . consume ( testKey , 1 )
796
761
. then ( ( ) => {
797
762
rateLimiter . consume ( testKey , 1 )
@@ -814,7 +779,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
814
779
815
780
it ( 'block key forever, if secDuration is 0' , ( done ) => {
816
781
const testKey = 'neverexpire' ;
817
- const rateLimiter = new RateLimiterRedis ( { storeClient : redisMockClient , points : 1 , duration : 1 , useIoredis : true } ) ;
782
+ const rateLimiter = new RateLimiterRedis ( { storeClient : redisMockClient , points : 1 , duration : 1 } ) ;
818
783
rateLimiter . block ( testKey , 0 )
819
784
. then ( ( ) => {
820
785
setTimeout ( ( ) => {
@@ -833,7 +798,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
833
798
834
799
it ( 'set points by key' , ( done ) => {
835
800
const testKey = 'set' ;
836
- const rateLimiter = new RateLimiterRedis ( { storeClient : redisMockClient , points : 1 , duration : 1 , useIoredis : true } ) ;
801
+ const rateLimiter = new RateLimiterRedis ( { storeClient : redisMockClient , points : 1 , duration : 1 } ) ;
837
802
rateLimiter . set ( testKey , 12 )
838
803
. then ( ( ) => {
839
804
rateLimiter . get ( testKey )
@@ -849,7 +814,7 @@ describe('RateLimiterRedis with fixed window', function RateLimiterRedisTest() {
849
814
850
815
it ( 'set points by key forever' , ( done ) => {
851
816
const testKey = 'setforever' ;
852
- const rateLimiter = new RateLimiterRedis ( { storeClient : redisMockClient , points : 1 , duration : 1 , useIoredis : true } ) ;
817
+ const rateLimiter = new RateLimiterRedis ( { storeClient : redisMockClient , points : 1 , duration : 1 } ) ;
853
818
rateLimiter . set ( testKey , 12 , 0 )
854
819
. then ( ( ) => {
855
820
setTimeout ( ( ) => {
0 commit comments