MCPcopy
hub / github.com/codeaashu/claude-code / processQueue

Function processQueue

src/utils/sequential.ts:25–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23 let processing = false
24
25 async function processQueue(): Promise<void> {
26 if (processing) return
27 if (queue.length === 0) return
28
29 processing = true
30
31 while (queue.length > 0) {
32 const { args, resolve, reject, context } = queue.shift()!
33
34 try {
35 const result = await fn.apply(context, args)
36 resolve(result)
37 } catch (error) {
38 reject(error)
39 }
40 }
41
42 processing = false
43
44 // Check if new items were added while we were processing
45 if (queue.length > 0) {
46 void processQueue()
47 }
48 }
49
50 return function (this: unknown, ...args: T): Promise<R> {
51 return new Promise((resolve, reject) => {

Callers 2

sequentialFunction · 0.85
useNotificationsFunction · 0.85

Calls 2

shiftMethod · 0.80
resolveFunction · 0.70

Tested by

no test coverage detected