Skip to content

Don't die on "pong" response #7

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrisboyle
Copy link

To reproduce, make a script that:

  1. Logs in
  2. Successfully powers something on or off.
  3. Sleeps/awaits some other resource until ping_hb() has run at least once (> 152 seconds for me)
  4. Tries a power on or off command

It fails with some combination of TimeoutError and CancelledError, and after I Ctrl-c the script I see a JSON parse error at character 0 happening on the line in the patch below.

With this patch, my long-lived script is happy - specifically I'm watching the Hue event stream for button-presses with aiohue bridge.subscribe(handler).

When we ping_hb() the server pongs.

If you sleep long enough for this to happen (152 seconds?) your
subsequent operations fail, ultimately due to trying to parse
`pong` as JSON.
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.

1 participant