v1.0.65: cloud pagination fix for creating status

This commit is contained in:
2026-07-27 11:42:41 +04:00
parent 90a32353eb
commit 120c34ffcf
4 changed files with 19 additions and 5 deletions
+6 -3
View File
@@ -4,10 +4,13 @@ from api.http_client import HttpClient
def get_instances(client):
results = []
page = 1
page_size = 200
while True:
data = client.get("/instances", params={"pageSize": 200, "page": page})
results.extend(data.get("results", []))
if len(results) >= data.get("total", 0):
data = client.get("/instances", params={"pageSize": page_size, "page": page})
batch = data.get("results", []) or []
results.extend(batch)
# Не доверяем total: если страница вернула меньше pageSize, значит данные закончились.
if len(batch) < page_size:
break
page += 1
return results