abersheeran / asgi-ratelimit

A ASGI Middleware to rate limit
Apache License 2.0
292 stars 11 forks source link

Make response header `Retry-after` #27

Closed abersheeran closed 3 years ago

abersheeran commented 3 years ago

Closed #18

euri10 commented 3 years ago

I havent gone deep into it but and at first sight this looks good, except I think the retry-after is not correct on blocked routes: if I put a breakpoint here on line 134: https://github.com/abersheeran/asgi-ratelimit/blob/ee5671056911474b4f4a10fddaf27326053039c8/tests/backends/test_redis.py#L131-L134 I'm blocked for 5s so I would expect a retry-after: 5 and I have a 1

20210615_1431_690x841_1623760287

abersheeran commented 3 years ago

@euri10 I fixed it.

abersheeran commented 3 years ago

@euri10 Can you implement Retry-After for SlidingRedisBackend when you are free?

euri10 commented 3 years ago

@euri10 Can you implement Retry-After for SlidingRedisBackend when you are free?

yes, will try over this week-end !

abersheeran commented 3 years ago

I feel maybe we should add some tests on it, but overall this LGTM!

I agree. I will add more tests.