Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread-safety documentation contradiction? #3297

Open
meshantz opened this issue Jun 28, 2024 · 0 comments
Open

Thread-safety documentation contradiction? #3297

meshantz opened this issue Jun 28, 2024 · 0 comments

Comments

@meshantz
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant