Trouble disconnecting clients due to ConnectionError #15

Open
dkellerman opened this Issue Jul 3, 2011 · 3 comments

Projects

None yet

4 participants

@dkellerman

I'm not sure if this is an issue with brukva, or just something I don't understand about the best way to use it.

I have handler such as the following:

class MessageHandler(RequestHandler):
    def __init__(self, *args, **kwargs):
        super(MessageHandler, self).__init__(*args, **kwargs)
        self.redis = brukva.Client()
        self.redis.connect()
        self.redis.subscribe('messages')

    @tornado.web.asynchronous
    @tornado.web.authenticated
    def post(self):
        self.redis.listen(self.on_new_message)

    def on_new_message(self, result):
        self.redis.unsubscribe('messages')
        self.redis.disconnect()

        self.finish(dict(
            messages=tornado.escape.json_decode(result.body)
        ))

This works, but I see "ConnectionError('Tried to read from non-existent connection')" in the console - it seems to be happening after the on_new_message is done. If I take out the disconnect call it fixes it, but then all my connections stay open.

Do you know of any solution to this problem?

Thanks!

@patrickod

I'd also really appreciate any input on this. I'm trying to use short-term connections to redis but it seems that the disconnect function raises the ConnectionError.

@nellessen

Might be related to #25 ?

@shadda

This is still happening, is there any work around?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment