Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/schematic/event_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def push(self, event: CreateEventRequestBody):
def stop(self):
try:
self.stopped = True
# Do a final flush before shutting down to avoid losing buffered events
self._flush()
self.shutdown.set()
self.flush_thread.join(timeout=5)
except Exception as e:
Expand Down Expand Up @@ -222,6 +224,8 @@ async def push(self, event: CreateEventRequestBody):
async def stop(self):
try:
self.stopped = True
# Do a final flush before shutting down to avoid losing buffered events
await self._flush()
self.shutdown_event.set()
await self.flush_task
Copy link
Contributor

@ryanechternacht ryanechternacht Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need to await this then? I guess it shouldn't hurt -- it no-ops anyway

(the await self.flush_task)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do because we want to ensure that the background tasks close before we return.

except Exception as e:
Expand Down
Loading