fix(FN-5363): implement targetTaskId in store SQL so lease targets correct task
The previous commit wired targetTaskId through the engine caller but the store's acquireMergeQueueLease SQL still grabbed the queue head unconditionally, leaving the no-lease loop intact. This lands the store-side change: when targetTaskId is provided it attempts a direct-match UPDATE first; only falls back to queue-head ordering if that row isn't available (backward-compatible). Adds regression test covering the polluted-queue-head scenario (FN-5363). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,9 @@ export interface MergeQueueEnqueueOptions {
|
||||
export interface MergeQueueAcquireOptions {
|
||||
leaseDurationMs: number;
|
||||
now?: string;
|
||||
/** If provided, the lease attempt targets this specific task first.
|
||||
* The task must be unexpired/available; otherwise falls back to normal queue-head selection. */
|
||||
targetTaskId?: string;
|
||||
}
|
||||
|
||||
export type MergeQueueReleaseOutcome =
|
||||
|
||||
Reference in New Issue
Block a user