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

More accurate heartbeat timing #95

Merged
merged 9 commits into from
Jun 3, 2016

Conversation

nigelsim
Copy link
Contributor

@nigelsim nigelsim commented Mar 9, 2016

The original heartbeat thread was prone to missing heartbeat sends due to the accuracy of the sleep timing. This modification calculates the sleep time based on when the next event is required, instead of being a fixed time. An example of the old code missing sleeps is here:

2016-03-07 14:34:30 stomp.py INFO Sending frame cmd='STOMP' headers={'passcode': 'xxx', 'login': 'xxx', 'accept-version': '1.1', 'heart-beat': '10000,0'}
2016-03-07 14:34:40 stomp.py INFO Sending frame cmd=None headers={}
2016-03-07 14:34:50 stomp.py INFO Sending frame cmd=None headers={}
2016-03-07 14:35:00 stomp.py INFO Sending frame cmd=None headers={}
2016-03-07 14:35:10 stomp.py INFO Sending frame cmd=None headers={}
2016-03-07 14:35:30 stomp.py INFO Sending frame cmd=None headers={}
2016-03-07 14:35:50 stomp.py INFO Sending frame cmd=None headers={}

Additionally there is a cleanup of the heartbeat thread reference so that the thread is properly restarted if we reconnect following a timeout.

@nigelsim
Copy link
Contributor Author

nigelsim commented Jun 2, 2016

This has been updated to work on Python 3 correctly

@jasonrbriggs
Copy link
Owner

Thanks.

@jasonrbriggs jasonrbriggs merged commit ad2d594 into jasonrbriggs:master Jun 3, 2016
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

Successfully merging this pull request may close these issues.

3 participants