Skip to main content
All CollectionsFeatures and APIs
How are multiple global statistic operations handled?
How are multiple global statistic operations handled?

Muliple users editing a global stat.

Paul Winterhalder avatar
Written by Paul Winterhalder
Updated over 5 years ago

The IncrementGlobalStats method is an atomic operation. 

We ensure requests are handled one at a time, by locking the stats until the updating process is complete. Following subsequent calls wait in parallel, until all the operations finish.

So regardless of how many users interact on a statistic, it will be incremented and decremented as expected.

Note that when using ProcessStatistics, it is possible that using a SET operation will be unreliable, in an event where two or more users are editing a statistic. As such, it is best to use the INC, DEC, MAX, MIN, INC_TO_LIMIT, and DEC_TO_LIMIT operations when knowing that multiple users will be acting on a stat.

Find further information on Global and Player Statistics in our API Reference: https://getbraincloud.com/apidocs/apiref/#capi-playerstats

Happy coding!

Did this answer your question?