Skip to content

Plex websocket callback async cleanup#40992

Merged
balloob merged 2 commits intohome-assistant:devfrom
jjlawren:plex_websocket_callback_async_cleanup
Oct 1, 2020
Merged

Plex websocket callback async cleanup#40992
balloob merged 2 commits intohome-assistant:devfrom
jjlawren:plex_websocket_callback_async_cleanup

Conversation

@jjlawren
Copy link
Copy Markdown
Contributor

@jjlawren jjlawren commented Oct 1, 2020

Proposed change

Cleanup async use on new callback.

Followup from post-merge comments on #40773.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

hass.data[PLEX_DOMAIN][DISPATCHERS].setdefault(server_id, [])
hass.data[PLEX_DOMAIN][DISPATCHERS][server_id].append(unsub)

@callback
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is called by the Plex media server. This decorator doesn't do anything.

I think that the current code is correct?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The websocket is running in async context so we need to change the api below. The decorator here is not needed but can be used for clarity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the decorator more as a comment on the expected context.

@balloob balloob added this to the 0.116.0 milestone Oct 1, 2020
@balloob balloob merged commit 8c4b571 into home-assistant:dev Oct 1, 2020
@jjlawren jjlawren deleted the plex_websocket_callback_async_cleanup branch October 1, 2020 19:57
balloob pushed a commit that referenced this pull request Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants