Skip to content

Commit 31329e3

Browse files
committed
fix(node): Check database continuation when scan budget ends on exact batch boundary
When candidate scanning reaches MAX_TASK_SCAN_CANDIDATES without finding a target_visible row and the final batch was full, probe the database for rows beyond the scan position so an exhausted candidate stream is not erroneously marked incomplete. Refs #327
1 parent 760a538 commit 31329e3

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎crates/gitlawb-node/src/api/tasks.rs‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,22 @@ pub(crate) async fn collect_visible_tasks(
318318
} else if stream_ended {
319319
(false, None)
320320
} else {
321-
(true, examined)
321+
// When scan budget was reached on an exact batch multiple, probe if any row
322+
// exists beyond the scan budget in the database.
323+
let more_in_db = !db
324+
.list_tasks_keyset(
325+
status,
326+
assignee_did,
327+
1,
328+
examined.as_ref().map(TaskPosition::as_pair),
329+
)
330+
.await?
331+
.is_empty();
332+
if more_in_db {
333+
(true, examined)
334+
} else {
335+
(false, None)
336+
}
322337
};
323338

324339
let incomplete = has_more && visible.len() < bounded_limit;

0 commit comments

Comments
 (0)