fiber/middleware/limiter
nickajacks1 1e55045a30
test(limiter): fix intermittent failures (#2716)
The limiter middleware unit tests are failing due to a race between the
storage garbage collector and the unit test itself. The sliding window
limiter tracks requests using memory storage. In several of the unit
tests, this storage expiry ends up being 4 seconds. The test waits for 4
seconds, then sends a request, expecting it to succeed. However, the
unit test occasionally wakes up before the storage GC kicks in. As an
effect of the very coarse timer (using seconds as units), the middleware
correctly rejects the request, causing the test to fail.

Update the sleep to 4.5 seconds. This will not slow down the execution
of the test suite, as these tests run in parallel with a separate 9
second long test.

I'm not 100% sure this solves the issue, and ideally we'd be able to
run tests without time.Sleep.
2023-11-10 11:33:10 +01:00
..
config.go 🚀 Add Logger interface and fiberlog (#2499) 2023-06-26 08:16:57 +02:00
limiter.go feat: add sliding window as option for limiter middleware (#1580) 2021-10-18 09:13:53 +02:00
limiter_fixed.go Improve memory storage (#2162) 2022-10-19 16:22:42 +02:00
limiter_sliding.go Fix Sliding Window limiter when SkipSuccessfulRequests/SkipFailedRequests is used. (#2484) 2023-06-01 08:00:31 +02:00
limiter_test.go test(limiter): fix intermittent failures (#2716) 2023-11-10 11:33:10 +01:00
manager.go 🐛 Bug: Fix issues introduced in linting PR (#2319) 2023-02-02 15:57:40 +01:00
manager_msgp.go 🐛 Bug: Fix issues introduced in linting PR (#2319) 2023-02-02 15:57:40 +01:00