question

chris-3 avatar image
chris-3 asked

TitleData and Timeouts

All of the errors I get at the moment revolve around timeout errors, the actual error seems to be determined by the call made.

For example:

    "FunctionName": "LeagueActive",
    "ProcessorTimeSeconds": 0.0,
    "ExecutionTimeSeconds": 4.0462289999999994,
    "MemoryConsumedBytes": 392424,
    "HttpRequestsIssued": 0,
    "APIRequestsIssued": 1,


Caused by the read of a single internalTitleData entry. This entry is written too twice every two weeks (midnight on Friday - set to true - and 1am on Friday - set to false).

handlers.LeagueActive = function(args)
{
	var response = { LeagueActive: true };


	var internalTitleData = server.GetTitleInternalData({
		Keys: ["leagueReseting"]
	}).Data;


	if(internalTitleData && internalTitleData.leagueReseting)
	{
		var isReseting = JSON.parse(internalTitleData.leagueReseting);
		response.LeagueActive = !isReseting;
	}


	return response;
}	

The other calls are similar. Often times stacked with three or four calls running timing out at the same time.

Is there anything at all I can do ?

I had been going through all the cloudscript functions I had to reduce their execution times and reduce the number of API calls where possible, stacking statistics updates and userdata changes were I could, etc. Then last night this one showed up and I'm at a loss as to what I can do to stop something like this.

In case you're wondering about the error:

    "Logs": [
      {
        "Message": "PlayFab API request failure",
        "Level": "Error",
        "Data": {
          "request": {
            "Keys": [
              "leagueReseting"
            ]
          },
          "error": "Timeout",
          "api": "/Server/GetTitleInternalData"
        }
      }
    ],
    "Error": {
      "Message": "InternalServerError",
      "Error": "InternalServerError",
      "StackTrace": "Error\n    at handlers.LeagueActive (C615-main.js:2081:33)"
    }
  },
CloudScriptTitle Data
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

·
Citrus Yan avatar image
Citrus Yan answered

Hi, your code seems fine to me. According to the error message, the error happened when calling /Server/GetTitleInternalData, I tried to reproduce your issue using your code but got no luck. So I am wondering if you could provide us your Title ID so we can investigate it? Thanks.

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

chris-3 avatar image chris-3 commented ·

title id is C615

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan chris-3 commented ·

Hi, we’ve checked your title’s CloudScript Error Records and found out that they all happened within a small period of time, maybe this is caused by temporary server glitch. Are you able to make these calls properly now? If not, please provide us some details about the errors such as screenshot. Thanks, any issues let us know.

0 Likes 0 ·
chris-3 avatar image chris-3 commented ·

Yeah, it happens about 3-10 times a day. There is a couple of times each week where 8-10 calls fail at the same time (there is then a nice spike in the error graph on overview page).

Some of the calls say Service Unavailable (btw) which I saw was caused by delays to AWS (from checks on the forums here).

I was looking for ways to reduce the error count futher and these timeouts are all that's left for the most part.

I can trap them on catch them on the client side and retry but that can lead to data rate exceeded errors (I had to deal with that some with the checks around entering a match to ensure no cheating). So retries would just increase the problem. Especially if I hit one of the stacked errors times.

Thanks for looking.

0 Likes 0 ·
chris-3 avatar image chris-3 chris-3 commented ·

btw whats the recommended way to run an rules triggered event again if the original call fails due to a timeout?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan chris-3 commented ·

Hi, regarding to the errors, we have reported it to our product team to investigate. As for running an rules triggered event again, you could try to write a custom timeout event when the original call fails to trigger the original call again. You could give it a try, any issues let us know:)

0 Likes 0 ·
Show more comments

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.