Skip to content

Commit

Permalink
Throw away outdated values (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
sroyal-statsig authored Jul 5, 2024
1 parent 9728fe2 commit 8d39580
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dotnet-statsig/src/Statsig/Server/Evaluation/SpecStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,20 @@ private bool ParseResponse(string? response)
return false;
}

JToken? time;
LastSyncTime = json.TryGetValue("time", out time) ? time.Value<long>() : LastSyncTime;


if (!json.TryGetValue("has_updates", out var hasUpdates) || !hasUpdates.Value<bool>())
{
return false;
}

JToken? time;
var newTime = json.TryGetValue("time", out time) ? time.Value<long>() : LastSyncTime;
if (newTime < LastSyncTime)
{
return false;
}
LastSyncTime = newTime;

var newGates = new Dictionary<string, ConfigSpec>();
var newConfigs = new Dictionary<string, ConfigSpec>();
var newLayerConfigs = new Dictionary<string, ConfigSpec>();
Expand Down

0 comments on commit 8d39580

Please sign in to comment.