question

Andriy Bychkovskyi avatar image
Andriy Bychkovskyi asked

Problem with daily challenge reset

Hello.

I have daily challenge feature in my game. It works pretty simple every player has Player Data field "playedDailyChallenge". And I have 2 scheduled tasks which run daily. "Randomize daily challenge seed" for random map seed generation and "Reset daily challenge" which sets Player Data field "playedDailyChallenge" to FALSE for each player in "All players" segment.

And it worked fine at least for month. But recently I start getting complains from players that daily challenge is not working. I checked and for some players "playedDailyChallenge" is TRUE despite the fact that they didn't play today. So I started investigating the problem and found that "Reset daily challenge" task failed 2 times in recent days with error message:

Maximum number of concurrent bulk segment jobs are already running

But still it's not giving me the answer why "playedDailyChallenge" wasn't reset for some players because "Reset daily challenge" runned succesfully yesterday. I checked Task details again and found that SegmentId is marked as Deleted:

{
    "SegmentId": "E35F39E572188E7A [Deleted]",
    "ActionId": "7DCCC243EC9ED7CC"
}

For now I made a new player segment called "Everyone" as a replacement for "All players", maybe it will help me to solve this problem. But clearly, there is something wrong with it.

Player Datascheduled tasks
10 |1200

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

brendan avatar image
brendan answered

Please turn on the publish PlayStream event option on the scheduled task: https://developer.playfab.com/en-us/F82B/servers/scheduled-tasks/999932250DFACD0D/edit. That then would give you the ability to review any failures, to look for issues. It's a relatively simple operation, but there's still some opportunity for failure, whether due to a server falling over in AWS or a concurrent edit error. The latter shouldn't be the case, since the player wasn't signed in, but we'd need more data to know for sure.

However, all that aside, there's a far more reliable and simple way to enable this feature. Trying to set a value on every player has multiple issues: concurrent edit could prevent the update, and the update takes non-zero time per player. So as you grow the title, it'll take longer to get through all players. So if your daily challenge is supposed to trigger at a certain time, some players won't have the update to that value for some indeterminate time after that. Instead, just have the client update (possibly through Cloud Script, if you want it to be secure) a timestamp of the last time they did the daily challenge. That way, you can simply determine their eligibility for the latest challenge by checking that.

2 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.

Andriy Bychkovskyi avatar image Andriy Bychkovskyi commented ·

I turned on PlayStream option. Also, I noticed that "Reset daily challenge" task is not running at all, at least it's not displayed in 100 most recent task execution list. It didn't run today, and it is not running when I am trying to execute it manually. So, for now, I made another scheduled task with the same function as a temporary workaround. And I'll remake daily challenge feature as you suggested.

0 Likes 0 ·
brendan avatar image brendan Andriy Bychkovskyi commented ·

My concern is that you're trying to start two Scheduled Tasks at 00:00 UTC, when your limit of the number of concurrent tasks you can have running is 1, since you're in the Essentials tier. One of those tasks is title-level and should run extremely quickly, so it's possible that most of the time it's done by the time the service is attempting to start the other, but if it isn't, that would block starting the task that runs over the user segment.

0 Likes 0 ·
brendan avatar image
brendan answered

What is the Title ID, so that we can have a look at it?

1 comment
10 |1200

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

Andriy Bychkovskyi avatar image Andriy Bychkovskyi commented ·

F82B. Thank you!

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.