question

Tahir avatar image
Tahir asked

Whats the most efficient way to update multiple userdata ?

I have game servers that need to update the user data for all connected players at the end of a match. Whats the best way to handle this? I assume looping through all players and calling `UpdateUserReadOnlyData` isnt the recommended route?

Player DataCustom Game Servers
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

·
Rick Chen avatar image
Rick Chen answered

As there is no API that could batch update the User Data, for the condition that the players were in a match of your game server, the best way would be calling Update User Data API for each player.

If you have any further questions, please feel free to ask.

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.

Tahir avatar image Tahir commented ·

Alright but would you suggest just using a for loop and calling Update User Data for each player? Or having some sysem to ensure each player is updated before moving on to the next?

I remember seeing something regarding making too many calls of the same function being problematic

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ Tahir commented ·

You could call the Update User Data asynchronously using for loop. Sometimes there could be errors when making too many simultaneous calls. In this case, you could use the exponential retry strategy to handle the error. For more detail, please refer to: Handling the error.

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.