question

george-1 avatar image
george-1 asked

Internal Server Error: Timeout

We are having a few timeouts with a cloudscript. We are wondering what we can do to fix this. The timeout doesn't happen with everybody, just like 5 times a day and the script runs probably like 1,000 times a day. We would still like it to work all the time.

The script is a reward system for hitting target in a certain order or at least getting a reward for hitting them all in the time limit. Is it a big O problem? The PlayerOwnsCosmetic() is a tough one because we have to go through the player's inventory to find if the player has the cosmetic. So I imagine players with big inventory might have the script take longer?

5640-image.png

5651-image.png

CloudScriptPlayer Inventory
image.png (128.3 KiB)
image.png (28.3 KiB)
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

·
Gosen Gao avatar image
Gosen Gao answered

As CloudScript timeout error mentioned, If you encounter this error, you can:

  1. break your CloudScript (Legacy) into smaller code segments which will run in under 4 seconds.

  2. Switch to CloudScript using Azure Functions, which has longer timeout limits in some cases.

Since it is not occurred frequently, you can also implement a retry mechanism in client to retry with an exponential delay back-off. For more info, you can refer to SDK error handling Best Practices - PlayFab | Microsoft Docs.

10 |1200

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

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.