Open mlissner opened 1 year ago
Oh, and this ratelimiter seems to support async already, but I don't know how good it is: https://pypi.org/project/django-fast-ratelimit/
If it's as good or better than django-ratelimit (which I kind of doubt?), then we could switch to it completely. It'd be sad though, to have two ratelimiting packages around forever.
I also noticed that one of our ratelimiters is busted because it doesn't get the IP address from the headers properly:
That line should be tweaked to use the CloudFront-Viewer-Address
header instead (docs here). This is probably a good helper for that:
We use django-ratelimit to ratelimit our views, but when we made a bunch of our views async, the decorator failed and we we had to remove it temporarily to make things work again (see: https://github.com/freelawproject/courtlistener/pull/2935/). It's important that we make it work again for three reasons:
Making these all async is great, but we need to continue protecting them.
I opened a new issue here, asking for async support in django-ratelimit:
https://github.com/jsocol/django-ratelimit/issues/293
It has gotten some activity, but I haven't kept up.
Issue COURTLISTENER-4FT is an example of what currently happens when a ratelimiter is triggered on an async view: