Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble disconnecting clients due to ConnectionError #15

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

Trouble disconnecting clients due to ConnectionError #15

dkellerman opened this issue Jul 3, 2011 · 3 comments

Comments

@dkellerman
Copy link

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
Copy link

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
Copy link

Might be related to #25 ?

@shadda
Copy link

shadda commented Jul 12, 2013

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants