Daxay suggested an idea · Aug 28, 2020 at 05:46 PM · CloudScriptPlayer Datadata
It would be great if we can have this feature.
It would be useful in preventing concurrency.
For example, I have one claimDailyRewards cloudscript function which gives reward to user in their inventory.
I want to give user reward only 1 time during day, so for that i am using DAILY_REWARD_STATS key for storing daily timer details and no of day.
Here the main problem is if two concurrent request from same user come then there are high chances that both request add rewards to user.
I am using below code. As you can see i am updating readonly data as soon as current data validation completed.
const combinedData = server.GetPlayerCombinedInfo({ PlayFabId: currentPlayerId, InfoRequestParameters: { GetUserReadOnlyData: true, UserReadOnlyDataKeys: [UserReadonlyDataKeys.DAILY_REWARD_STATS], GetUserVirtualCurrency: true, }, }).InfoResultPayload; const userReadonlyData = combinedData.UserReadOnlyData; const userBalance = combinedData.UserVirtualCurrency; if (!userReadonlyData[UserReadonlyDataKeys.DAILY_REWARD_STATS]) { throw new Error('You are not yet eligible to claim reward'); } server.UpdateUserReadOnlyData({ PlayFabId: currentPlayerId, KeysToRemove: [UserReadonlyDataKeys.DAILY_REWARD_STATS], });
Stills it won't be enough to prevent concurrent requests.
But using this feature we can prevent concurrent requests.
We would love to know what you need. Submit your ideas and upvote others to help us prioritize.
Is Friend Online ? Provide API to get last player activity timestamp.
Dash: Save JSON recipes for args
Allow optional param to include full CatalogItem info for item-related calls
fuzzy search OR Partial DisplayName search
Update the Server API to allow UpdateUserTitleDisplayName