22
33from .base import BaseDataClass
44from .event_response import EventInteraction
5- from ..misc import date_to_unix
5+ from ..misc import date_to_unix , list_chunks
66from ..misc .constants import ACCESSIBILITY_DICT
77
88if TYPE_CHECKING :
@@ -170,6 +170,21 @@ async def resolve_responders(self, force: bool = False) -> List['EventInteractio
170170 player = self .client .accounts .create_dataclass (response .player_id )
171171 response .player = player
172172 players [response .player_id ] = player
173- data : 'Response[List[AccountResponse]]' = await self .rec_net .accounts .bulk .make_request ('post' , body = {"id" : players .keys ()})
174- for data_response in data .data : players .get (data_response ['accountId' ]).patch_data (data_response )
173+
174+ player_ids = list (players .keys ())
175+ data : List [AccountResponse ] = []
176+
177+ # 750 == roughly 9750 bytes of payload
178+ # limit of 10240 bytes in API
179+ if len (player_ids ) > 750 :
180+ player_chunks = list_chunks (player_ids , 750 )
181+ for i in player_chunks :
182+ response : 'Response[List[AccountResponse]]' = await self .rec_net .accounts .bulk .make_request ('post' , body = {"id" : i })
183+ data += response .data
184+ else :
185+ # Fits in a single payload
186+ response : 'Response[List[AccountResponse]]' = await self .rec_net .accounts .bulk .make_request ('post' , body = {"id" : player_ids })
187+ data = response .data
188+
189+ for data_response in data : players .get (data_response ['accountId' ]).patch_data (data_response )
175190 return self .responses
0 commit comments