question

matias avatar image
matias asked

Scheduled Tasks Execution Time

I will start explaining what i'm trying to do and then what problem i'm facing. So i have a leaderboard where every day you have a winner, but if you've won in the last month you can't win again (your score is still shown in the leaderboard) and the price goes to the next in line. So I made a function in Azure that does the following:

  1. Grabs the current leaderboard

  2. Reset the leadearboard (it runs at the same time as the next step)

  3. Check the user internal data to check if he won in the last 30 days, if not moves to the next player in the leaderboard until we have someone who hasn't win in the last month.

  4. Gives the price to the winner

Now the only problem i'm facing is that sometimes (not always) it runs out of time and the function is shown as failed. Sometimes it takes around 1600ms, others 3000ms and sometimes it fails because of the 4500ms Limit. Something i want to point out, the max number of players we need to check is 31, so we are running this with the same number of players everytime. Also we end the player check as soon as a winner is found and we are testing this with the number 31 being the winner (Just to make sure that it can support the max number without failing). If we run this without Scheduled Tasks it works 100% of the times. The problem is we need to run this in Scheduled Tasks Here you can see that sometimes it works and sometimes it doesn't

5822-imagen-2023-04-17-104207222.png

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

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

A scheduled task failing with a timeout does not mean that the Azure Function execution failed, it means that PlayFab did not get a response to the current request within the time limit, but the function is actually still running. You may refer to Debugging CloudScript using Azure Functions in the Azure portal - PlayFab | Microsoft Learn to check the Log Stream in Azure portal to see if the function execute successfully.

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.

matias avatar image matias commented ·

Thanks, Yes we tested it and it was working but i wanted to be sure that this was the case

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha matias commented ·

If your Azure Function is running properly, timeout errors in the scheduled task should not affect the results of the function run.

-1 Like -1 ·

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.