From 4736869c80a0a1e2a3636ac41e9e1a87d02cd850 Mon Sep 17 00:00:00 2001 From: Benjamin Chrobot Date: Sat, 29 Jul 2023 06:57:40 -0400 Subject: [PATCH] test: revert changes to bucket config --- src/index.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.spec.ts b/src/index.spec.ts index 0272c69..e31e4bc 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -27,15 +27,17 @@ describe('integration test', () => { const rateLimiter = getLeakyBucketRateLimiter({ redis, bucketTypes: { - // 6 invocations a second + // Drain at 3 invocations a second bucket: { capacity: 6, drainCount: 3, - drainInterval: 2000, + drainInterval: 1000, }, }, }); + let highestN = 0; + const task: Task = async (payload: any) => { if (payload.n > highestN) { highestN = payload.n; @@ -51,8 +53,6 @@ describe('integration test', () => { pollInterval: 20, // need a smaller poll interval }); - let highestN = 0; - // if i add 7 jobs, 6 should be run after 100ms, but the 7th shouldnt be run until after 1.1 seconds await Promise.all( [...Array(7)].map((_, n) => {