You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use redis as backend for the limiter
limiter = Limiter(key_func=get_remote_address, storage_uri="redis://:/n")
The limits async docs, however, say that you have to construct the uri like so
from limits.storage import storage_from_string
redis = storage_from_string("async+redis://localhost:6379")
I can't really tell if the implementation is asyncio-compatible currently, that is, changing the uri to async+redis will make it possible to decorate my async endpoint without blockking the event loop.
Hi @larsclaussen at the moment, the implementation is fully sync, so even if the async backend url works, slowapi won't be able to fully take advantage of it at the moment. The code you're after is probably this line. This is the oldest issue with the code #3 and nobody's gotten around to tackling it entirely yet (including myself 😅 )
Thanks for the clarification. Maybe a good idea to state that clearly in the readme. It is misleading because most examples are async examples and using a backend like redis (or any other of the backends stated) will result a in the whole event loop being blocked with every limit check.
The docs state
The limits async docs, however, say that you have to construct the uri like so
I can't really tell if the implementation is asyncio-compatible currently, that is, changing the uri to
async+redis
will make it possible to decorate my async endpoint without blockking the event loop.The text was updated successfully, but these errors were encountered: