33import asyncio
44import logging
55from datetime import datetime , timezone
6- from math import ceil
76from typing import TYPE_CHECKING , Any , cast
87
98import pandas as pd
@@ -231,7 +230,8 @@ async def get_channel_data(
231230 run_id : str | None = None ,
232231 start_time : datetime | None = None ,
233232 end_time : datetime | None = None ,
234- limit : int | None = None ,
233+ max_results : int | None = None ,
234+ page_size : int | None = None ,
235235 ignore_cache : bool = False ,
236236 ) -> dict [str , pd .DataFrame ]:
237237 """Get the data for a channel during a run."""
@@ -247,10 +247,11 @@ async def get_channel_data(
247247 )
248248
249249 tasks = []
250- page_size = limit if limit and limit < 1000 else 1000
251- limit = ceil (limit / page_size ) if limit else 10
252250 # Queue up calls for non-cached channels in batches.
253251 batch_size = REQUEST_BATCH_SIZE
252+ page_size = None
253+ if max_results is not None and max_results <= CHANNELS_DEFAULT_PAGE_SIZE :
254+ page_size = max_results
254255 for i in range (0 , len (not_cached_channels ), batch_size ): # type: ignore
255256 batch = not_cached_channels [i : i + batch_size ] # type: ignore
256257
@@ -264,7 +265,7 @@ async def get_channel_data(
264265 "end_time" : end_time ,
265266 },
266267 page_size = page_size ,
267- max_results = limit ,
268+ max_results = max_results ,
268269 )
269270 )
270271 tasks .append (task )
@@ -294,7 +295,7 @@ async def get_channel_data(
294295 "end_time" : new_end_time or end_time ,
295296 },
296297 page_size = page_size ,
297- max_results = limit ,
298+ max_results = max_results ,
298299 )
299300 )
300301 tasks .append (task )
0 commit comments