I'm triggering an azure function every time an item is grant to the user as using Rules. If item that granted to user is have specific class, than I am granting a another item to user in that azure function. Everything is working fine on PlayFab side but seems like the azure function triggering late. I want to elaborate the problem with an example:
I have two catalog item in primary catalog.
1=> A_Strong_Car (Item class: Car)
2=> Wheel_Tier_2 (Item class: CarWheel)
If an user purchase A_Strong_Car item, then I need grant Wheel_Tier_2 item to this user as free price.
I have I rule for listening grant items. The name of this rule is OnItemGranted and this rule is triggering by com.playfab.player_inventory_item_added event. This rule is executing a azure function when triggered. The name of executing azure function is OnItemGranted. In this azure function, I am checking the class of item that granted. If the class of item is Car, then I am grant Wheel_Tier_2 item to user with custom data as using serverApi.GrantItemsToUsers api.
The Wheel_Tier_2 item is successfly granting to user but the user is not see this second item in his inventory when user refresh the inventory rgiht after the PlayFabClientAPI.PurchaseItem api resulted as successful.
After the PlayFabClientAPI.PurchaseItem api resulted as successful; if the user does not wait and immediately call PlayFabClientAPI.GetUserInventory for refreshing the inventory, then user will not see Wheel_Tier_2 in his inventory.
But If user wait for a little bit(Like a 1 second) after PlayFabClientAPI.PurchaseItem api resulted as successful and then call PlayFabClientAPI.GetUserInventory for refreshing the inventory, then user will see Wheel_Tier_2 in his inventory.
I don't want the user to wait for the com.playfab.player_inventory_item_added event. I think the event should be trigger synchronous with time to grant item to user, not asynchronous. The action(Mean OnItemGranted azure function in this case) that connected to rule must have finished his work(process of azure function) already if PlayFabClientAPI.PurchaseItem api resulted as successful.