MCPcopy Create free account
hub / github.com/anomalyco/opencode / take

Function take

packages/app/src/context/global-sync/queue.ts:18–27  ·  view source on GitHub ↗
(count: number)

Source from the content-addressed store, hash-verified

16 const tick = () => new Promise<void>((resolve) => setTimeout(resolve, 0))
17
18 const take = (count: number) => {
19 if (queued.size === 0) return [] as string[]
20 const items: string[] = []
21 for (const [id, directory] of queued) {
22 queued.delete(id)
23 items.push(directory)
24 if (items.length >= count) break
25 }
26 return items
27 }
28
29 const schedule = () => {
30 if (timer) return

Callers 1

drainFunction · 0.70

Calls 2

pushMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected