Update html5 to use async_add_executor_job (#41788)
parent
c08f984f2b
commit
af74e36d16
|
@ -242,7 +242,9 @@ class HTML5PushRegistrationView(HomeAssistantView):
|
||||||
try:
|
try:
|
||||||
hass = request.app["hass"]
|
hass = request.app["hass"]
|
||||||
|
|
||||||
await hass.async_add_job(save_json, self.json_path, self.registrations)
|
await hass.async_add_executor_job(
|
||||||
|
save_json, self.json_path, self.registrations
|
||||||
|
)
|
||||||
return self.json_message("Push notification subscriber registered.")
|
return self.json_message("Push notification subscriber registered.")
|
||||||
except HomeAssistantError:
|
except HomeAssistantError:
|
||||||
if previous_registration is not None:
|
if previous_registration is not None:
|
||||||
|
@ -288,7 +290,9 @@ class HTML5PushRegistrationView(HomeAssistantView):
|
||||||
try:
|
try:
|
||||||
hass = request.app["hass"]
|
hass = request.app["hass"]
|
||||||
|
|
||||||
await hass.async_add_job(save_json, self.json_path, self.registrations)
|
await hass.async_add_executor_job(
|
||||||
|
save_json, self.json_path, self.registrations
|
||||||
|
)
|
||||||
except HomeAssistantError:
|
except HomeAssistantError:
|
||||||
self.registrations[found] = reg
|
self.registrations[found] = reg
|
||||||
return self.json_message(
|
return self.json_message(
|
||||||
|
|
Loading…
Reference in New Issue