Update html5 to use async_add_executor_job (#41788)

pull/41796/head
J. Nick Koston 2020-10-13 15:26:14 -05:00 committed by GitHub
parent c08f984f2b
commit af74e36d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -242,7 +242,9 @@ class HTML5PushRegistrationView(HomeAssistantView):
try:
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.")
except HomeAssistantError:
if previous_registration is not None:
@ -288,7 +290,9 @@ class HTML5PushRegistrationView(HomeAssistantView):
try:
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:
self.registrations[found] = reg
return self.json_message(