question

Matt Rochon avatar image
Matt Rochon asked

Economy V2: Catalog updates

So I have Rules attached to item_created, item_updated, item_deleted. It seems when i publish a new version of the item these events are firing before the item finishes updating.

I use this to cache the latest timestamp of catalog updates so I can control when catalogs are downloaded by the clients.

The issue here is when the event fires it seems that the item is being updated and not part of the catalog download, which causes alot of issues.

Basically there are 2 problems here.

  1. The item seems to be removed from the public catalog while it is being published. Since i download the catalog at runtime this causes issues for clients that have inventory items of those entries.

  2. When i publish the item, the updated/created/deleted events should fire after the item operation is completed, so if i were to download the current state of the catalog at that moment it would reflect the correct state.

In-Game Economy
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.

Matt Rochon avatar image Matt Rochon commented ·

Hmm one update, I was only able to reproduce issue #1 twice, most times it iseems to still return with the public catalog, though it may have something to do with the amount of time it takes to publish, or perhaps a transactional issue where i unluckily requested the catalog in between the remove and save operations?

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha Matt Rochon commented ·

Since I can't reproduce your issue, could you please provide more detailed steps to reproduce.?

0 Likes 0 ·

1 Answer

·
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

The events you've listed all apply to the Draft catalog and originate from APIs like CreateDraftItem. They all get fired synchronously after the draft item is created, updated, or deleted. In contrast, the publish process is asynchronous, even when kicked off through the draft APIs by setting Publish to true. It may take a while to commit and replicate the data across the production backend. It's generally quick, but the asynchronous nature means there will always be a race condition.

You can get the status of any publish operation using the following API.

https://learn.microsoft.com/en-us/rest/api/playfab/economy/catalog/get-item-publish-status?view=playfab-rest

3 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.

Matt Rochon avatar image Matt Rochon commented ·

So I'm talking about updating an existing item in my catalog. In this case it appeared that the item was no longer being returned in SearchItems whent he publish was in progress, event he old version of the item. This obviously would cause issues but I believe I have tracked it down.

1) I am creating/publishing new items via the api. 2) Some items would never have IsHidden=true, so i was cheerfully omitting that property. 3) It looks like if i omit that property it does not default to 'false' but to null 4) This caused my SearchItems query filter [IsHidden eq false] to fail.

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha Matt Rochon commented ·

Glad to hear you have tracked down the issue. You can use the filter "IsHidden ne true" to get items that don't have the IsHidden property set and items that have IsHidden property set to false.

0 Likes 0 ·
kylemc@microsoft.com avatar image kylemc@microsoft.com Matt Rochon commented ·

Let me look into that IsHidden = null vs. false. That feels tricky and nonsensical to me. I'll investigate whether it's a bug.

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.