fix(events): a conversation's own stream carries its updates
This commit is contained in:
1 parent
65564d8541
commit
9875f08016
2 files changed
+27
-1
No files matched your search
@@ -57,10 +57,16 @@ class EventBus:
|
||||
event = await queue.get()
|
||||
if (
|
||||
conversation_id is None
|
||||
or event.get("conversation_id") == conversation_id
|
||||
or _conversation_of(event) == conversation_id
|
||||
):
|
||||
yield event
|
||||
|
||||
@property
|
||||
def subscribers(self) -> int:
|
||||
return len(self._subscribers)
|
||||
|
||||
|
||||
def _conversation_of(event: Event) -> Any:
|
||||
if event["type"].startswith("conversation."):
|
||||
return event.get("id")
|
||||
return event.get("conversation_id")
|
||||
Reference in new issue
Block a user