If TrackerManager.DispatchPeriod is set in non zero value, for example 10 seconds, then all hits that were collected from application startup time will be sent every 10 seconds. This is because DispatchAsync() method doesn't clear hits queue for hits that are sent.
Current method's code should be changed to :
public async Task DispatchAsync()
{
if (!isEnabled) return;
Task allDispatchingTasks = null;
lock (dispatchingTasks)
{
if (dispatchingTasks.Any())
{
allDispatchingTasks = Task.WhenAll(dispatchingTasks);
}
}
if (allDispatchingTasks != null)
{
await allDispatchingTasks;
}
if (!isEnabled) return;
Hit[] hitsToSend;
lock (hits)
{
hitsToSend = hits.ToArray();
hits.Clear(); // clear queue.
}
if (hitsToSend.Any())
{
await RunDispatchingTask(DispatchQueuedHits(hitsToSend));
}
}
If
TrackerManager.DispatchPeriod
is set in non zero value, for example 10 seconds, then all hits that were collected from application startup time will be sent every 10 seconds. This is becauseDispatchAsync()
method doesn't clear hits queue for hits that are sent. Current method's code should be changed to :Please, fix library.