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
Description:
The documentation for run_in_thread with exception_handler is misleading. Sample code you provide (with annotations)
p.subscribe(**{'my-channel': my_handler})
def exception_handler(ex, pubsub, thread):
print(ex)
thread.stop()
thread.join(timeout=1.0) # this raises RuntimeError("cannot join current thread")
pubsub.close() # this never gets called
thread = p.run_in_thread(exception_handler=exception_handler)
The handler runs in the context of the thread, and the thread argument is "self".
Calling join() on itself, the handler will raise RuntimeError("cannot join current thread"), and exit "uncleanly" (without closing pubsub). so it works, but it seems a bit misleading.
These might be better examples for the documentation:
Version: 5.0.5
but really the current online documentation https://redis-py.readthedocs.io/en/stable/advanced_features.html#publish-subscribe
Platform: Python 3.12 fedora40
Description:
The documentation for run_in_thread with exception_handler is misleading. Sample code you provide (with annotations)
The handler runs in the context of the thread, and the thread argument is "self".
Calling join() on itself, the handler will raise RuntimeError("cannot join current thread"), and exit "uncleanly" (without closing pubsub). so it works, but it seems a bit misleading.
These might be better examples for the documentation:
or
The text was updated successfully, but these errors were encountered: