Handle error events properly in commands

This commit is contained in:
Alex Wolden
2025-04-14 09:03:56 -07:00
parent fa8ebcb50a
commit 52553a41bd
4 changed files with 117 additions and 26 deletions

View File

@@ -116,10 +116,11 @@ class EventDispatcher:
event = await self.queue.get()
logger.debug(f"Dispatching event: {event.type}, {event.payload}, {event.attributes}")
for subscription in self.subscriptions.copy():
logger.debug(f"Checking subscription: {subscription.event_type}, {subscription.attribute_filters}")
# Check if event type matches
if subscription.event_type is None or subscription.event_type == event.type:
# Check if all attribute filters match
if subscription.attribute_filters:
if subscription.attribute_filters and subscription.attribute_filters != {}:
# Skip if any filter doesn't match the corresponding event attribute
if not all(event.attributes.get(key) == value
for key, value in subscription.attribute_filters.items()):