From f04fb33de86d576de2719894cfe4aad046e906d6 Mon Sep 17 00:00:00 2001 From: crismacv Date: Sun, 4 Jan 2026 04:00:38 +0000 Subject: [PATCH] Fix: take last task from the pending tasks --- affine/api/services/task_pool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/affine/api/services/task_pool.py b/affine/api/services/task_pool.py index 86a4d131..31a25a3a 100644 --- a/affine/api/services/task_pool.py +++ b/affine/api/services/task_pool.py @@ -514,7 +514,7 @@ async def fetch_task( if isinstance(result, Exception): continue if isinstance(result, list) and result: - candidate_tasks.append(result[0]) # Take first task + candidate_tasks.append(result[-1]) # Take last task # Take first batch_size tasks and assign in parallel tasks_to_assign = candidate_tasks[:batch_size]