I have the following code (not full code), which updates a players stat in leaderboard from the client (yes, I know this isnt recommended)
UpdatePlayerStatistics( new UpdatePlayerStatisticsRequest { Statistics = new List<StatisticUpdate> { new StatisticUpdate { StatisticName = highScoreTableName, Value = score }, } }, result => { GetLeaderboard(playFabID); }, error => { // handle error, not shown. });
So far, so simple. This works, and the leaderboard is updated on the server.
Now, if in my "GetLeaderboardFunction" - I *IMMEDIATELY* do this:
private static void GetLeaderboard(string fabID) { GetLeaderboardAroundPlayerRequest request = new GetLeaderboardAroundPlayerRequest(); request.PlayFabId =fabID; request.MaxResultsCount = 11; request.StatisticName =highScoreTableName; GetLeaderboardAroundPlayer(request, OnLeaderboardGetAroundPlayerSuccess, OnGeneralLoginFailure); }
This will return the leaderboard BEFORE the update happened (almost like it was cached). But the leaderboard on the server is correct.
Now strangely - if I put a breakpoint at the top of "GetLeaderboard" - and wait a few seconds.. then let it run, the modified updated table will return.
Is there any way to make the "GetLeaderboardAroundPlayer" function wait until the above call has finished and get the new updated (or non-cached) version?