mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Speed up serializing event messages (#100017)
This commit is contained in:
parent
e4af50f955
commit
ad4619c038
@ -94,7 +94,9 @@ def _cached_event_message(event: Event) -> str:
|
||||
The IDEN_TEMPLATE is used which will be replaced
|
||||
with the actual iden in cached_event_message
|
||||
"""
|
||||
return message_to_json({"id": IDEN_TEMPLATE, "type": "event", "event": event})
|
||||
return message_to_json(
|
||||
{"id": IDEN_TEMPLATE, "type": "event", "event": event.as_dict()}
|
||||
)
|
||||
|
||||
|
||||
def cached_state_diff_message(iden: int, event: Event) -> str:
|
||||
|
@ -953,7 +953,7 @@ class Event:
|
||||
{
|
||||
"event_type": self.event_type,
|
||||
"data": ReadOnlyDict(self.data),
|
||||
"origin": str(self.origin.value),
|
||||
"origin": self.origin.value,
|
||||
"time_fired": self.time_fired.isoformat(),
|
||||
"context": self.context.as_dict(),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user