From 939fce4607f51b144ff6568096dbd6571272684b Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Mon, 20 Mar 2023 04:35:16 +0100 Subject: [PATCH] Shield Reolink webhook callback from cancelation (#89798) * shield Reolink webhook callback from cancelation * Update homeassistant/components/reolink/host.py Co-authored-by: Paulus Schoutsen * fix styling * fix black * Revert to using asyncio.shield --------- Co-authored-by: Paulus Schoutsen --- homeassistant/components/reolink/host.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/homeassistant/components/reolink/host.py b/homeassistant/components/reolink/host.py index e8e96ffe9b9..9ba4809e90d 100644 --- a/homeassistant/components/reolink/host.py +++ b/homeassistant/components/reolink/host.py @@ -327,6 +327,12 @@ class ReolinkHost: 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."""