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
6 changes: 4 additions & 2 deletions com.posthog.unity/Runtime/PostHogSDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ void ShutdownInternal()
// Stop exception tracking
_exceptionManager?.Stop();

_eventQueue?.Stop();
// Flush before stopping to ensure final events are sent
_eventQueue?.Flush();
_eventQueue?.Stop();

// Wait for any pending file writes to complete
if (_storage is FileStorageProvider fileStorage)
Expand Down Expand Up @@ -952,8 +953,9 @@ void OnAppBackground()

void OnAppQuit()
{
_eventQueue.Stop();
// Flush before stopping to ensure final events are sent
_eventQueue.Flush();
_eventQueue.Stop();

// Synchronously flush pending file writes before quitting
if (_storage is FileStorageProvider fileStorage)
Expand Down