Hello! We've been having a recurrent problem with Cloudscript calls since we started using it a few years back, so I thought it's about time I ask about this!
In a small fraction of cases, a Cloudscript call (made with ExecuteCloudScript through the Unity SDK) gets triggered twice. It seems to happen at random - we haven't been able to reproduce it, or to find any pattern in terms of handlers, devices, etc. A player will report an error, and when we look at the Event History, we see that the handler has been called twice almost simultaneously (with a difference below half a second). The second call will normally fail, as it should, sometimes with ConcurrentEdit errors, other times because the first call has already modified some data and the second is no longer valid. Unfortunately, that second call will often return its result first, while the first one is still running, so the client will show an error to the user, even when the operation has been completed successfully by the first call and the result arrives an instant later. It may only happen about once every 10k calls, but it still adds up to multiple cases every day.
We are pretty certain that our code isn't generating the duplicate calls, though if no one else has experienced a similar problem I guess we'd have to take another look. Since Cloudscript is stateless, and the calls happen so close to each other, we haven't been able to come up with a way to detect and deal with these duplicate calls on the server side. We have added some client code to handle these errors in the most important handlers, but it's fairly custom for each call so it's very inefficient to do it for all handlers and scenarios.
You can check a recent case in titleId AE2C, playerId 598BDB67A6CD70AF, eventIds:
2fc6f0938e9647f3bad4499238edf67b (at 2018-11-05T11:37:21.037183Z)
c2a931b38e5e4d16b7ccc4cf253885fe (at 2018-11-05T11:37:21.294064Z)
Is this something you have seen before? Is there any recommended pattern for dealing with it?
We are using version 180213 of the Unity SDK (which I know is fairly out of date, but I haven't seen anything related to this error on the release notes) and , though as
Thank you in advance!