Open JoseKilo opened 2 months ago
Hi maintainers, thank you for the package !
This line can fail with a ConnectionError, at least when using the Redis backend, possibly others too:
ConnectionError
https://github.com/encode/broadcaster/blob/69cf29a41066f53a45498f0dfa36288befd73dd7/broadcaster/_base.py#L95
When that happens, queue is never added to self._subscribers[channel].
queue
self._subscribers[channel]
But the finally block will try to remove it nonetheless, causing a KeyError and hiding the original issue:
finally
KeyError
https://github.com/encode/broadcaster/blob/69cf29a41066f53a45498f0dfa36288befd73dd7/broadcaster/_base.py#L102
Possible solutions:
discard
remove
_backend.subscribe
try
self._backend.unsubscribe
None
I could prepare a PR with any of those if they make sense.
Hi maintainers, thank you for the package !
This line can fail with a
ConnectionError
, at least when using the Redis backend, possibly others too:https://github.com/encode/broadcaster/blob/69cf29a41066f53a45498f0dfa36288befd73dd7/broadcaster/_base.py#L95
When that happens,
queue
is never added toself._subscribers[channel]
.But the
finally
block will try to remove it nonetheless, causing aKeyError
and hiding the original issue:https://github.com/encode/broadcaster/blob/69cf29a41066f53a45498f0dfa36288befd73dd7/broadcaster/_base.py#L102
Possible solutions:
discard
instead ofremove
_backend.subscribe
call outside thetry
block: when that call fails you can probably skipself._backend.unsubscribe
. You'd still need to put aNone
in the queue though.I could prepare a PR with any of those if they make sense.