mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Build JSON in executor (#12536)
This commit is contained in:
parent
39847ea651
commit
fb985e2909
@ -303,8 +303,10 @@ class HistoryPeriodView(HomeAssistantView):
|
|||||||
entity_ids = entity_ids.lower().split(',')
|
entity_ids = entity_ids.lower().split(',')
|
||||||
include_start_time_state = 'skip_initial_state' not in request.query
|
include_start_time_state = 'skip_initial_state' not in request.query
|
||||||
|
|
||||||
result = yield from request.app['hass'].async_add_job(
|
hass = request.app['hass']
|
||||||
get_significant_states, request.app['hass'], start_time, end_time,
|
|
||||||
|
result = yield from hass.async_add_job(
|
||||||
|
get_significant_states, hass, start_time, end_time,
|
||||||
entity_ids, self.filters, include_start_time_state)
|
entity_ids, self.filters, include_start_time_state)
|
||||||
result = result.values()
|
result = result.values()
|
||||||
if _LOGGER.isEnabledFor(logging.DEBUG):
|
if _LOGGER.isEnabledFor(logging.DEBUG):
|
||||||
@ -327,7 +329,8 @@ class HistoryPeriodView(HomeAssistantView):
|
|||||||
sorted_result.extend(result)
|
sorted_result.extend(result)
|
||||||
result = sorted_result
|
result = sorted_result
|
||||||
|
|
||||||
return self.json(result)
|
response = yield from hass.async_add_job(self.json, result)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
class Filters(object):
|
class Filters(object):
|
||||||
|
@ -136,7 +136,8 @@ class LogbookView(HomeAssistantView):
|
|||||||
|
|
||||||
events = yield from hass.async_add_job(
|
events = yield from hass.async_add_job(
|
||||||
_get_events, hass, self.config, start_day, end_day)
|
_get_events, hass, self.config, start_day, end_day)
|
||||||
return self.json(events)
|
response = yield from hass.async_add_job(self.json, events)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
class Entry(object):
|
class Entry(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user