question

Matt avatar image
Matt asked

Delay between posting a stat and receiving leaderboard?

Hi folks,

So one of my beta testers completed a level that stores their completion time as a statistic then shows the leaderboard values. After posting her value and then reporting the leaderboard results, her time came back as 0 instead of her actual time. When she refreshed the leaderboard it corrected itself (via a second call to GetLeaderboard).

I make these calls via the cloud, but is there still some sort of delay between setting a stat and getting the leaderboards for that stat? If so, how can I be sure there's a safe time to make the call so that the player's recent performance is actually included?

This is my call flow:

Client: Player completes a timed level and a call to a CloudScript function is made.

Cloud: Various work, calls server.UpdatePlayerStatistic, then returns to client

Client: client then calls PlayFabClientAPI.GetLeaderboard

So what seems to have happened is that the server call, from within my cloudscript, to UpdatePlayerStatistic had some sort of delay that prevented it from completing before the client made the GetLeaderboard call.

Is that something that is known? Is there perhaps something else going on?

Thanks for the help, it's much appreciated!

-Matt

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image
Citrus Yan answered

It takes a while for the leaderboard to be updated after a stat is posted, therefore it’s a good idea to wait a second or two before querying the updated leaderboard. For more details, please check out these threads:

https://community.playfab.com/questions/42030/is-there-a-delay-between-updateplayerstatistics-an.html

https://community.playfab.com/questions/20182/realtime-leaderboard-solution.html

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt avatar image
Matt answered

*edit* - No longer seeing ANY delays in getting leaderboards, this isn't a problem at all!

Thanks for the reply, I should've been more thorough in searching for previous questions about this. However...as of right now, this is an incredibly poor implementation for me and I'm wondering if there's something I should be doing differently.

When the player completes my level, I made a CloudScript call to update all of their information, including the stat update for their fastest time. When that call returns, I wait a few seconds and then make a call to get the latest leaderboard values. When this leaderboard call returns, I compare this players current time to the one supplied by the leaderboard call result...if their current time is faster, then I assume the stat hasn't propagated so I queue up another call for a couple seconds later. Right now, while typing out this response, I've been waiting around 5 minutes and the cycle is still going, waiting to get the latest values.

As far as player experience goes, it's terrible to complete a level with a certain time and not be able to see your leaderboard standing for, I mean at this point, several minutes (if ever?).

Is there any suggestion besides me just showing the old values and telling the player "Sorry, this is old data"?

Thanks!

-Matt

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image Citrus Yan commented ·

Usually it doesn't take that long (several minutes) for the leaderboard to get updated after posting the stats, may I know your title id and the stat name that's having such delays?

0 Likes 0 ·
Matt avatar image Matt Citrus Yan commented ·

My Title ID is AC50, but I don't remember the exact statistic I was testing. What I can say is since then I haven't seen any significant delays at all, so I imagine it may have been a one-off fluke, or perhaps even something I was doing to cause it. In any case, don't waste your time on it, but I appreciate the help either way.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Matt commented ·

OK, don't hesitate to tell us if you ever running into issue again:)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.