I got this error message because I waited to long in my cloud script function:
"Error": { "Error": "CloudScriptExecutionTimeLimitExceeded", "Message": "The script execution was terminated after the maximum execution time limit", "StackTrace": null }
In addition, I got this PlayStream event:
Raw event JSON { "EventName": "title_exceeded_limit", "LimitId": "CloudScript:ScriptExecutionTime", "LimitDisplayName": "Processing time for a CloudScript function called by the ExecuteCloudScript API.", "Unit": "Seconds", "LimitValue": 4.5, "Value": 4.5137887, "AssociatedEntities": { "player": [ "C30AD4505A3C3388" ] }, "Details": { "Function": "UpdateLeaderboard" }, "EventNamespace": "com.playfab", "EntityType": "title", "Source": "PlayFab", "EventId": "8bb1a51b12bc44eebc7045b81e8fce97", "EntityId": "BFD0A", "SourceType": "BackEnd", "Timestamp": "2020-01-05T18:20:21.7273474Z", "History": null, "CustomTags": null, "Reserved": null, "PlayFabEnvironment": { "Vertical": "master", "Cloud": "main", "Application": "logicserver", "Commit": "14dbbed" } }
Is my maximum execution time limit 4.5 seconds(4500 milliseconds)?
Is it possible to get more execution time?
I want to create a waiting time(for example 1000 milliseconds) so that the client can not call server.UpdateUserReadOnlyData and server.UpdateUserInternalData very frequently.
Are 1000 milliseconds a reasonable waiting time?
I use this code to create the waiting time:
handlers.UpdateLeaderboard = function (args, context) { var waitingtime = 600000; // just for testing the limit sleep(waitingtime); server.UpdateUserReadOnlyData ... } function sleep(milliseconds) { const date = Date.now(); let currentDate = null; do { currentDate = Date.now(); } while (currentDate - date < milliseconds); }