mirror of
https://github.com/stablyai/orca.git
synced 2026-10-12 16:03:03 +00:00
fix: address pr-bug-scan findings from #1424
Flip parentFieldRetried inside the probe IIFE before resolveProbe() runs, eliminating the race where siblings wake between resolve and flag flip and issue duplicate with-parent probes.
This commit is contained in:
@@ -842,7 +842,7 @@ async function fetchAllItems(args: {
|
||||
})
|
||||
probePromise = (async () => {
|
||||
try {
|
||||
return await fetchItemsPageWithRaw({
|
||||
const result = await fetchItemsPageWithRaw({
|
||||
owner: args.owner,
|
||||
ownerType: args.ownerType,
|
||||
projectNumber: args.projectNumber,
|
||||
@@ -851,6 +851,17 @@ async function fetchAllItems(args: {
|
||||
after: null,
|
||||
includeParent: true
|
||||
})
|
||||
// Why: flip parentFieldRetried BEFORE resolving the probe so siblings
|
||||
// awaiting parentFieldProbeInFlight observe the updated flag. Doing
|
||||
// this in the outer block (after `await probePromise`) leaves a gap
|
||||
// between resolveProbe()/clearing parentFieldProbeInFlight and the
|
||||
// flag flip — sibling callers wake up in that gap, see
|
||||
// parentFieldRetried=false and parentFieldProbeInFlight=null, and
|
||||
// issue their own duplicate with-parent probe.
|
||||
if (!result.ok && errorsIndicateParentField(result.rawErrors, result.stderr)) {
|
||||
parentFieldRetried = true
|
||||
}
|
||||
return result
|
||||
} finally {
|
||||
resolveProbe()
|
||||
parentFieldProbeInFlight = null
|
||||
|
||||
Reference in New Issue
Block a user