question

kexiaowei avatar image
kexiaowei asked

,Help about player data

,

Hi,

Is a cloudscript function can execute synchronously?

for example,

var data = Server.GetUserInternalData({

PlayFabId: currentPlayerId,

Keys:['flag']

}).Data['flag']

// Is any possible a same cloudscript function was execute synchronously and change the 'flag' here?

if (!data) {

// do something
server.UpdateUserInternalData({

PlayFabId: currentPlayerId,

Data: { flag: true }

}) }

Is any possible data was change between GetUserInternalData and UpdateUserInternalData

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

·
brendan avatar image
brendan answered

Cloud Script calls run their logic synchronously, but I would strongly recommend using error checking on each Server API call (and handling any error appropriately), to make sure you're getting back the data you expect, rather than assuming it's there. As far as changes to the local data variable, no, if you're not changing it in the script, it cannot have changed between the two calls. If you believe you're seeing something different, can you please provide specifics - the Title ID, handler name, PlayFab ID you tested this on, and the specifics of any parameters passed into the call to run the Cloud Script (or the event that triggers the script, if you're using PlayStream for this)?

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.