question

toannguyen avatar image
toannguyen asked

Timeout on cloudscript, how to prevent it?

Hi.

Because playfab doesnt have API for getting list guild so im using Google Cloud SQL for interact and manager Guild List.

But i got trouble with TIMEOUT error, example below will describe a case when i try to create a guild and insert few data on Cloud SQL. The first part is okay (guild has been created on Playfab) but timeout when connect to Cloud SQL. I 've checked connection to Cloud SQL and it always be good and respond always less than 1 second.

It happens 1 time per 2-3 requests (including get list guild from google cloud via cloud script)

Log from result.Log:

"{\"url\":\"https://spacex-xxxx.appspot.com/guild/InsertGuild?id=8AB186B989316CF9&name=Super marine&member=1&point=0&region=VN&logo=6&maxMember=20&key=playfab151\",\"result\":{\"responseContent\":null,\"httpStatus\":null,\"httpStatusCode\":0,\"requestError\":\"Timeout\"},\"httpRequestError\":\"Timeout\"}"

Bonus: that guild has been created on cloud sql but still time out on the log.

Cloud script code:

var GetGuild_flink = "https://spacex-xxxx.appspot.com/guild/";
// google cloud SQL (create for searching + ranking)

var url = GetGuild_flink + "InsertGuild" + "?id=" + result.Group.Id + "&name=" + args.GuildName + "&member=" + "1" + "&point=" + "0" + "&region=" + "VN" + "&logo=" + args.Logo + "&maxMember=" + 20 + "&key=playfab151";

var response = http.request(url);           
// send log to client
var message = result.Group.Id;
log.info(message);
return {messageValue: message};

Limit for execution of cloud script is 4.5 seconds so i think it shouldnt happen too much

How can i prevent it and how to know the reason?, because i got "can not solve destination host when login on Playfab" and i dont know how to get respond time from external API on cloud script.

Thank you for helping me.

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

·
JayZuo avatar image
JayZuo answered

Although the limit for execution of cloud script is 4.5 seconds, the http.request call timeout is 2.5 seconds. If Cloud SQL service does not return within that period, the call will timeout, causing the script to fail. For more info, please see @Brendan's answer here: https://community.playfab.com/comments/24032/view.html.

I'm afraid there is no good way to prevent it as google cloud SQL needs time to perform query and that's not something we can control. You can contact sales team (sales@playfab.com) to discuss an Enterprise tier agreement with a longer timeout. And also check the Entity Groups document which is PlayFab's build in solution for Guilds.

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.

toannguyen avatar image toannguyen commented ·

thank you for your reply, we are solving this issue and maybe we will contact to sale team to upgrade our tier.

0 Likes 0 ·
Andy avatar image Andy ♦♦ toannguyen commented ·

Depending on your game's timeline, we may have a solution for you in the near future. In the next major update to the entities system, we're planning on adding a group search API. I don't have more details to share right now, but it should directly address your current requirements.

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.