Don't use executor in send_big_result (#75427)

This commit is contained in:
uvjustin 2022-07-19 21:40:23 +08:00 committed by GitHub
parent b6d235c0c2
commit 6b60fb9541
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 10 deletions

View file

@ -54,12 +54,9 @@ class ActiveConnection:
"""Send a result message."""
self.send_message(messages.result_message(msg_id, result))
async def send_big_result(self, msg_id: int, result: Any) -> None:
def send_big_result(self, msg_id: int, result: Any) -> None:
"""Send a result message that would be expensive to JSON serialize."""
content = await self.hass.async_add_executor_job(
JSON_DUMP, messages.result_message(msg_id, result)
)
self.send_message(content)
self.send_message(JSON_DUMP(messages.result_message(msg_id, result)))
@callback
def send_error(self, msg_id: int, code: str, message: str) -> None: