forked from AttackPattern/CSharpAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue AttackPattern#33 where multiple apps startup causes excep…
…tion to be thrown due to multiple session saving race.
- Loading branch information
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,12 +69,16 @@ public async void Start(MeasurementConfiguration configuration, string launchKin | |
sessionManager = new SessionManager(sessionState, configuration.SampleRate); | ||
await StartRequesterAsync(); | ||
|
||
if (delayedOptOut != null) SetOptOut(delayedOptOut.Value); | ||
// Preserve 'delayedOptOut' value to use in condition checking | ||
var hasDelayedOptOut = delayedOptOut; | ||
if (hasDelayedOptOut.HasValue) SetOptOut(delayedOptOut.GetValueOrDefault()); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
JimiC
Author
Owner
|
||
|
||
Client.Configure(configuration, sessionManager, GetEnvironment(), Add); | ||
|
||
// Sometimes apps crash so preserve at least session number and visitor id on launch | ||
await Save(sessionManager.GetState(), SessionStorageName); | ||
// Avoid re-saving if a delayed optout was set (save already occurred in 'SetOptOut') | ||
if (!hasDelayedOptOut.HasValue) | ||
await Save(sessionManager.GetState(), SessionStorageName); | ||
|
||
HookEvents(); | ||
} | ||
|
Should be
SetOptOut(hasDelayedOptOut.Value)
?