MCPcopy Index your code
hub / github.com/anomalyco/opencode / reusePendingTask

Function reusePendingTask

packages/opencode/src/cli/cmd/run/runtime.shared.ts:5–17  ·  view source on GitHub ↗
(slot: PendingTask<T>, run: () => Promise<T>)

Source from the content-addressed store, hash-verified

3}
4
5export function reusePendingTask<T>(slot: PendingTask<T>, run: () => Promise<T>) {
6 if (slot.current) {
7 return slot.current
8 }
9
10 const task = run().finally(() => {
11 if (slot.current === task) {
12 slot.current = undefined
13 }
14 })
15 slot.current = task
16 return task
17}

Callers 1

loadConfigFunction · 0.90

Calls 1

runFunction · 0.70

Tested by

no test coverage detected