dlecocq / nsq-py

Hacking on Python NSQ Bindings
MIT License
44 stars 16 forks source link

Reader only runs reconnection hook if connection is alive #29

Closed dlecocq closed 10 years ago

dlecocq commented 10 years ago

While added is correctly dispatched when adding a new connection (dead or alive), in the case of Reader, the reconnected hook should only be dispatched if the added connection is alive.

b4hand commented 10 years ago

LGTM pending the explanation we had in person.

dlecocq commented 10 years ago

The Client class provides an added hook to indicate the discovery and addition of new connections, independent of their ability to establish a socket connection. The Reader class had previously assumed that the added connection was alive and attempted to subscribe to it.

The Client only dispatches reconnected directly if the connection object was previously dead and becomes alive.