I'm wanting to adjust one of my internal title data parameters using a scheduled task to trigger a cloud script function that references the amount of players in a segment (at this point, a count of the players who have logged in over the past 7 days).
This does seem overall possible, though from what I can see only by using the "Get Players In Segment" call that pulls down far more player data than I need and has some API limitations on it.
All I want is the total count of the players in that segment, not their data. Is there a way to do this with a single call (so I don't have to cycle through all of the player data just to count) or perhaps a better way to accomplish this? I'd like to avoid running my own azure instance to cover this.
Answer by Brendan · Apr 21, 2020 at 02:37 AM
If all you want is the count, just call GetPlayersInSegment with MaxBatchSize set to 1. That'll minimize the amount of data returned. And you don't have to use the continuation token at all. In the response you get back, the ProfilesInSegment value is specifically the total number of players in the segment.
Please note that segment evaluation (which is triggered by this call) is very CPU intensive, so you do want to make sure not to call this too frequently. If you're thinking of more than once per hour, we should probably talk through your use case in more detail. And, of course, this should never be triggered from a user action.
That'll work perfectly, I only plan to run this once a week so frequent calls won't be a problem. Thanks
Answer by Pipeworks Truman · Aug 31, 2020 at 02:21 AM
Can I call this endpoint 12 times in one scheduled task, set to run every hour?