question

Kytan avatar image
Kytan asked

GetPlayersInSegment not working anymore.

I have a function I made in Cloud Script that I've been using for a few months and it was working up until a couple of days ago, I didn't change it and I don't understand what happened.

I'm using the GetPlayersInSegment function and its always returning 0, I have checked the SegmentId and its the correct one, the segment has about 900 entries.

This is the code:

 handlers.getLeaderboardEntriesAmountById = function (args, context) {
    
     var finalSegmentId = args.SegmentId
    
     var request = {
         "SegmentId": finalSegmentId,
         "MaxBatchSize": 1,
         "SecondsToLive": 1
     };
        
     var playersInSegmentResult = server.GetPlayersInSegment(request);
        
     playersAmount = JSON.parse(JSON.stringify(playersInSegmentResult)).ProfilesInSegment
        
     result = {
         "playersAmount": parseInt(playersAmount)
     }
        
     return result
 }
Player DataCloudScriptLeaderboards and Statistics
10 |1200

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

1 Answer

·
Neils Shi avatar image
Neils Shi answered

This issue could be related to the recent incidents about PlayStream and Segment: PlayFab Status - Segment events and Leaderboard stats are delayed and PlayFab Status - Titles are receiving errors with the GetPlayersInSegment API and Scheduled Tasks for segments. Please keep monitoring this issue to see if it persists after we resolve the incidents.

10 |1200

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

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.