rate limiter: Fix a race condition
authorrinpatch <rinpatch@sdf.org>
Fri, 28 Feb 2020 14:35:01 +0000 (17:35 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 29 Feb 2020 22:13:07 +0000 (01:13 +0300)
commit4d416343fae4a9e0b1654b12bd476017be63a7e9
tree272e3a611db85c2344f553f0e956cafaae27d4be
parentdf2173343accec7a7a311d85df2f13d5141b7bc7
rate limiter: Fix a race condition

When multiple requests are processed by rate limiter plug at the same
time and the bucket is not yet initialized, both would try to initialize
the bucket resulting in an internal server error.
lib/pleroma/plugs/rate_limiter/limiter_supervisor.ex
lib/pleroma/plugs/rate_limiter/rate_limiter.ex
test/plugs/rate_limiter_test.exs