Closed syavorsky closed 11 years ago
My bad, there is no issue with lib, I missed the fact that client.unsubscribe() issues {"kind":"unsubscribe"} message. That's where it attempts to use closed connection. So my example should look like this:
def on_message(self, msg):
if msg.kind == "message":
self.write(msg.body)
self.rd.unsubscribe(self.chanel)
elif msg.kind == "unsubscribe":
self.finish()
I've just started the 'connection-pool' branch to add a connection pool support (see issue#8). I plan to revise the code of connection handling. I suspect this bug is still there. So I've reopened this ticked to make sure this bug is fixed before I merge changes to master.
The code example in this issue contains an error (the self.finish()
call is misplaced there). However, I reopened it to make sure there are no new memory leak or connection handling issues when the connection pooling suppor is implemented.
I've tested the code dealing with channels, and it worked properly for me. So I'm closing this issue now.
Not sure if this is a bug, or I am just using it wrong, my apologies in advance) I've tried to use pub/sub for wrapping long polling and my handler looks pretty much same as WebSocket example you have. But right after first message handled (after unsubscribe and disconnect called) it still tries to communicate to redis and fails since connection was closed. BTW, WebSocket example is not working either.
https://gist.github.com/3720800