Skip to content
Open
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
16 changes: 9 additions & 7 deletions Assets/Talo Game Services/Talo/Runtime/APIs/EventsAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ public async Task Flush()
{
Talo.IdentityCheck();

var eventsToSend = queue.ToArray();
if (eventsToSend.Length == 0)
if (lockFlushes)
{
flushAttemptedDuringLock = true;
return;
}

if (lockFlushes)
var eventsToSend = queue.ToArray();
if (eventsToSend.Length == 0)
{
flushAttemptedDuringLock = true;
return;
}

Expand All @@ -103,14 +103,16 @@ public async Task Flush()

await Call(uri, "POST", content);
OnFlushed.Invoke();

eventsToFlush.Clear();
lockFlushes = false;
}
catch (Exception ex)
{
Debug.LogError(ex.Message);
}
finally
{
eventsToFlush.Clear();
lockFlushes = false;
}

if (flushAttemptedDuringLock)
{
Expand Down