MCPcopy Index your code
hub / github.com/npmx-dev/npmx.dev / fn

Function fn

test/unit/shared/utils/async.spec.ts:122–130  ·  view source on GitHub ↗
(item: (typeof items)[number])

Source from the content-addressed store, hash-verified

120 let tooManyRunningTasksEncountered = false
121 let currentlyRunning = 0
122 const fn = async (item: (typeof items)[number]) => {
123 currentlyRunning++
124 if (currentlyRunning > concurrency) {
125 tooManyRunningTasksEncountered = true
126 }
127 const task = s.schedule(Promise.resolve(item))
128 task.then(() => currentlyRunning--) // this task always succeeds by construct
129 return task
130 }
131 await s.waitFor(mapWithConcurrency(items, fn, concurrency))
132 expect(tooManyRunningTasksEncountered).toBe(false)
133 },

Callers 3

Base.stories.tsFile · 0.90
workerFunction · 0.85
createUpstashLockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected