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

BgServingThread doesn't keep _active up to date like it should. #89

Closed
peacetara opened this Issue Jun 8, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@peacetara

peacetara commented Jun 8, 2012

the _active is not kept up to date, if the connection is dropped for some reason. I know _active is a 'hidden' variable, but I would like it to be kept up to date anyway.

This is a very simple fix:

def _bg_server(self):
    try:
        while self._active:
            self._conn.serve(self.SERVE_INTERVAL)
            time.sleep(self.SLEEP_INTERVAL) # to reduce contention
    except Exception, e:
        if self._active:
            self._active = False    
            raise

This just sets _active to False, if there is any exceptions. Perhaps really we should compare the exceptions, because who knows what all the possible exceptions may be, but I would think for most exceptions that might happen, the connection will fall apart in the process of raising the exception.

Personally I'd love to see _active set to just active, and allow code to see it appropriately.

@tomerfiliba tomerfiliba reopened this Jun 8, 2012

@tomerfiliba

This comment has been minimized.

Owner

tomerfiliba commented Jun 8, 2012

Oops, I patched the wrong line. Will fix later

@peacetara

This comment has been minimized.

peacetara commented Jun 9, 2012

thanks :)

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