-
Couldn't load subscription status.
- Fork 2.6k
Description
I'm not sure if this is a bug, documentation oversight, or just a misunderstanding on my part.
Version: Current master at b7f9a4c
Description:
I'm messing around with pubsub, and I'm trying to wrap my head around something here.
https://redis-py.readthedocs.io/en/stable/advanced_features.html#a-note-about-threading
mentions:
It is not safe to pass PubSub or Pipeline objects between threads.
Then farther down the page, https://redis-py.readthedocs.io/en/stable/advanced_features.html#publish-subscribe
has an explanation of pubsub.run_in_thread (which I'm not intending to do, but I'm looking at what's involved in doing a thread-safe get_message call).
But the implementation https://github.com/redis/redis-py/blob/master/redis/client.py#L1162-L1223 looks like it violates the advice of not passing a PubSub to a thread.
It seems like there's an assumption that you won't do anything else with that pubsub instance here, but I don't see that made explicit anywhere, so I'd call the implementation "technically not thread-safe".
Am I misunderstanding something? Is there something else going on here?