Redis backend very slow for anything other than <uri>/0
Describe the bug
Changing the database number in the REDIS_URL (e.g. from redis://127.0.0.1:6379/0 to redis://127.0.0.1:6379/1) introduces up to 20s delays on rx.background updates.
For example, with a button that is set to increment a counter once every 0.1s for 1s. With /0 it does exactly that, with /1 it sometimes takes 10+s to change at all, and then sometimes changes as expected, or sometimes gets stuck part way and then continues.
Reproduce
Set the redis url with db num /1 (or any other than /0) and run any rx.background task.
Expected behavior Performance should be almost identical whether using db /0 or /1. 1
Specifics (please complete the following information):
- Python Version: 3.12
- Reflex Version: 0.5.10
- OS: WSL2 (redis running in docker)
- Redis: tried both 6.0.16 and 7.2.5
Additional context
Tried this with two separate reflex projects, same behaviour for both.
I checked latency with redis-cli --latency -n 1 and it showed no signs of being slow (~1ms).
Not a clue where to even begin with looking for the cause of the issue here... It was very easy to reproduce in my second project, so if it isn't easily reproducible for you then it's probably something related to my local docker setup.