You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/04/08 15:26:37 UTC
(tooling-trusted-releases) 01/01: #1065 - add limit to data returned when polling for task completion
This is an automated email from the ASF dual-hosted git repository.
arm pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 30d1a732f4ae72699f41b2bd98848cc30f930254
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Wed Apr 8 16:26:19 2026 +0100
#1065 - add limit to data returned when polling for task completion
---
atr/db/__init__.py | 3 +++
atr/tasks/distribution.py | 5 ++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/atr/db/__init__.py b/atr/db/__init__.py
index 08911e97..ea4abed3 100644
--- a/atr/db/__init__.py
+++ b/atr/db/__init__.py
@@ -307,6 +307,7 @@ class Session(sqlalchemy.ext.asyncio.AsyncSession):
pending: Opt[bool] = NOT_SET,
_with_release: bool = False,
_with_release_project: bool = False,
+ _limit: Opt[int] = NOT_SET,
) -> Query[sql.Distribution]:
query = sqlmodel.select(sql.Distribution)
if is_defined(release_key):
@@ -325,6 +326,8 @@ class Session(sqlalchemy.ext.asyncio.AsyncSession):
query = query.options(joined_load_nested(sql.Distribution.release, sql.Release.project))
elif _with_release:
query = query.options(joined_load(sql.Distribution.release))
+ if is_defined(_limit):
+ query = query.limit(_limit)
return Query(self, query)
async def execute_query(self, query: sqlalchemy.sql.expression.Executable) -> sqlalchemy.engine.Result:
diff --git a/atr/tasks/distribution.py b/atr/tasks/distribution.py
index 33ab78c5..f7d419b0 100644
--- a/atr/tasks/distribution.py
+++ b/atr/tasks/distribution.py
@@ -24,6 +24,7 @@ import atr.tasks as tasks
import atr.tasks.checks as checks
_RETRY_LIMIT = 5
+_BATCH_SIZE = 20
@checks.with_model(args.DistributionStatusCheckArgs)
@@ -33,7 +34,9 @@ async def status_check(
log.info("Checking pending recorded distributions")
dists = []
async with db.session() as data:
- dists = await data.distribution(pending=True, _with_release=True, _with_release_project=True).all()
+ dists = await data.distribution(
+ pending=True, _with_release=True, _with_release_project=True, _limit=_BATCH_SIZE
+ ).all()
for dist in dists:
name = f"{dist.platform} {dist.owner_namespace} {dist.package} {dist.version}"
dd = dist.distribution_data()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org