MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / apply

Method apply

apps/desktop/main/network/proxy-apply-queue.ts:4–15  ·  view source on GitHub ↗
(task: () => Promise<T>)

Source from the content-addressed store, hash-verified

2 private pendingApply: Promise<unknown> | null = null
3
4 apply<T>(task: () => Promise<T>): Promise<T> {
5 const previous = this.pendingApply ?? Promise.resolve()
6 const current = previous.catch(() => undefined).then(task)
7 this.pendingApply = current
8
9 const clear = () => {
10 if (this.pendingApply === current) this.pendingApply = null
11 }
12 current.then(clear, clear)
13
14 return current
15 }
16
17 async waitForPending(): Promise<void> {
18 const pending = this.pendingApply

Callers 4

handleRequestMethod · 0.80
applyProxyToSessionFunction · 0.80
testProxyConnectionFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected