Skip to content

Commit

Permalink
fix non closing HTTP SSE when client disconnected
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh.Vaidyanathan committed Oct 22, 2024
1 parent 336a311 commit 74bfaff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hololinked/server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,11 @@ async def handle_datastream(self) -> None:
if data:
# already JSON serialized
self.write(self.data_header % data)
await self.flush()
await self.flush() # log after flushing just to be sure
self.logger.debug(f"new data sent - {self.resource.name}")
else:
self.logger.debug(f"found no new data")
self.logger.debug(f"found no new data - {self.resource.name}")
await self.flush() # heartbeat - raises StreamClosedError if client disconnects
except StreamClosedError:
break
except Exception as ex:
Expand Down

0 comments on commit 74bfaff

Please sign in to comment.