Skip to content

Commit

Permalink
feat: Add async flush method
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Dec 18, 2024
1 parent b36ae23 commit b4be08c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Uno.DevTools.Telemetry/Telemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ public void Flush()
}
}

public async Task FlushAsync(CancellationToken ct)
{
if (!Enabled || _trackEventTask == null)
{
return;
}

// Skip the wait if the task has not yet been activated
if (_trackEventTask.Status != TaskStatus.WaitingForActivation)
{
await Task.WhenAny(_trackEventTask, Task.Delay(-1, ct));
}
}

public void Dispose()
{
_persistenceChannel?.Dispose();
Expand Down

0 comments on commit b4be08c

Please sign in to comment.