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

Keepalive has 2 bugs that prevent it from working properly #18

Closed
tagdara opened this issue Sep 11, 2018 · 1 comment · Fixed by #19
Closed

Keepalive has 2 bugs that prevent it from working properly #18

tagdara opened this issue Sep 11, 2018 · 1 comment · Fixed by #19

Comments

@tagdara
Copy link

tagdara commented Sep 11, 2018

At connection.py:32, the first time it triggers, the computed values is always equal to, not greater than self._keepalive on my system. It therefore skips the keepalive, eventually failing to a disconnect/reconnect.

if time.monotonic() - self._last_data_in > self._keepalive:

Changing the > to >= fixes it for me, making the first keepalive work.

I originally encountered this on a MQTT broker that wanted keepalives shorter than 60 seconds, and in the process of troubleshooting also discovered that you reset keepalive to a hardcoded 60 on a reconnect:

client.py:152
self._connection = await self._create_connection(self._host, self._port, clean_session=True, keepalive=60)

Maybe set a self._keepalive in the Client class with a default of 60 and override it from the connect procedure if a new value is provided?

@Lenka42
Copy link
Collaborator

Lenka42 commented Sep 12, 2018

Hi @tagdara Thanks for noticing 👍 I fixed issues you mentioned in PR #19
Next time we will be happy to see PRs from you 🙂

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 a pull request may close this issue.

2 participants