diff --git a/modules/features/teamsbot/service.py b/modules/features/teamsbot/service.py index 7e6eef59..bba2bab1 100644 --- a/modules/features/teamsbot/service.py +++ b/modules/features/teamsbot/service.py @@ -716,8 +716,10 @@ class TeamsbotService: interface = interfaceDb.getInterface(self.currentUser, self.mandateId, self.instanceId) - # Initialize SSE event queue - sessionEvents[sessionId] = asyncio.Queue() + # Reuse existing SSE event queue if a consumer (SSE generator) already + # holds a reference; replacing it would strand the SSE stream. + if sessionId not in sessionEvents: + sessionEvents[sessionId] = asyncio.Queue() try: # Update status to JOINING