Rishabh00b commented on code in PR #76268:
URL: https://github.com/apache/airflow/pull/76268#discussion_r4442761178
##########
airflow-ctl/src/airflowctl/api/operations.py:
##########
@@ -332,20 +332,28 @@ def execute_list(self, *, path, data_model, offset=0,
limit=50, params=None):
total_entries = first_pass.total_entries
# An older server that omits total_entries leaves it None; treat that
as "no more
# pages" rather than raising on the comparison below.
- if total_entries is None or total_entries < limit:
+ if total_entries is None:
return first_pass
found_key = None
for key, value in first_pass.model_dump().items():
if key != "total_entries" and isinstance(value, list):
found_key = key
break
+ if found_key is None:
+ return first_pass
entry_list = getattr(first_pass, found_key)
- offset = offset + limit
- while offset < total_entries:
+ # The server may cap ``limit`` (``api.maximum_page_limit``), so
advance by the number of
+ # entries received rather than by the requested limit, or the
capped-off entries are skipped.
+ page_size = len(entry_list)
+ offset = offset + page_size
+ if not page_size or offset >= total_entries:
Review Comment:
Good catch, removed it. Pushed in 45a9400
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]