Idea

Kevin avatar image
Kevin suggested

Specific error message for ETag-related inventory operation failures

With Economy v2, wAssert.IsNull(e can use ETags to detect and mitigate concurrency issues. For example, when we load a player's inventory in the game client, we can save the associated ETag. When the player tries to buy an item, we can include the last ETag we received with the request. If our ETag is out of date (because some other operation that we're not aware of changed the player's inventory), the request fails; presumably, at this point we would then refresh the player's inventory and then try again.

However, when the request fails because the ETag is out of date, PlayFab just gives us back a generic 400 Bad Request error (the PlayFab error code is 1071 InvalidRequest).

This is essentially useless, as it isn't safe to assume that a 400/1071 error always means that our ETag is out of date. There must be a specific error code (e.g. InvalidETag) so that we know how to appropriately handle the error.

In-Game Economy
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

2 Comments

·
Kevin avatar image
Kevin commented

I'm not sure how the Assert.IsNull( got in there; the fourth word should be "we". It doesn't seem like there's a way to edit your posts.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kylemc@microsoft.com avatar image
kylemc@microsoft.com commented

Thanks for reporting this. I'll double check the error path. I would have expected us to return a conflict response of some sort as well.

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

Kevin avatar image Kevin commented ·

@kylemc@microsoft.com Any word on this?

0 Likes 0 ·
kylemc@microsoft.com avatar image kylemc@microsoft.com Kevin commented ·

We will update the error response to return the ConcurrentEditError error code instead. I expect the update will hit production in the next week or so.

0 Likes 0 ·
Kevin avatar image Kevin kylemc@microsoft.com commented ·

@kylemc@microsoft.com In response to this question, you suggested that we could use the ETag to ensure that the player's inventory is up to date:

you could read and assume you have the latest state until you write. If you hit a conflict, re-read the collection and try to write again.

The ConcurrentEditError is defined like this:

Indicates too many simultaneous calls or very rapid sequential calls.

Under what other circumstances would we get this error? Is it a good idea to re-read the player's inventory any time we get ConcurrentEditorErrror back from an Economy V2 API request?
0 Likes 0 ·
Show more comments
Show more comments

Write a Comment

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.