Skip to content

Commit

Permalink
Shield Reolink webhook callback from cancelation (#89798)
Browse files Browse the repository at this point in the history
* shield Reolink webhook callback from cancelation

* Update homeassistant/components/reolink/host.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* fix styling

* fix black

* Revert to using asyncio.shield

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
  • Loading branch information
starkillerOG and balloob committed Mar 20, 2023
1 parent c94b054 commit 939fce4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions homeassistant/components/reolink/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ def unregister_webhook(self):

async def handle_webhook(
self, hass: HomeAssistant, webhook_id: str, request: Request
):
"""Shield the incoming webhook callback from cancellation."""
await asyncio.shield(self.handle_webhook_shielded(hass, webhook_id, request))

async def handle_webhook_shielded(
self, hass: HomeAssistant, webhook_id: str, request: Request
):
"""Handle incoming webhook from Reolink for inbound messages and calls."""

Expand Down

0 comments on commit 939fce4

Please sign in to comment.