Skip to content

Commit c409d6a

Browse files
authored
Merge pull request #803 from simvue-io/790-get_runs-returning-duplicates-of-some-objects
Fix Duplication of Entries in Pagination
2 parents 0629729 + 13d0529 commit c409d6a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

simvue/api/request.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,17 @@ def get_paginated(
303303
server response
304304
"""
305305
_offset: int = offset or 0
306+
307+
# Restrict the number of entries retrieved to be paginated,
308+
# if the count requested is below page limit use this value
309+
# else if undefined or greater than the page limit use the limit
310+
_request_count: int = min(count or MAX_ENTRIES_PER_PAGE, MAX_ENTRIES_PER_PAGE)
311+
306312
while (
307313
_response := get(
308314
url=url,
309315
headers=headers,
310-
params=(params or {})
311-
| {"count": count or MAX_ENTRIES_PER_PAGE, "start": _offset},
316+
params=(params or {}) | {"count": _request_count, "start": _offset},
312317
timeout=timeout,
313318
json=json,
314319
)

0 commit comments

Comments
 (0)