Something went wrong. Try again.
visualize bsky quote trends sites.wisp.place/zzstoatzz.io/quotree
Something went wrong. Try again.
1234567891011121314151617181920212223export async function runWorkQueue(initial, concurrency = 10) { const pending = [...initial]; const active = new Set(); let head = 0; const enqueue = (task) => pending.push(task);
try { while (head < pending.length || active.size) { while (head < pending.length && active.size < concurrency) { const task = pending[head]; pending[head++] = undefined; const running = Promise.resolve().then(() => task(enqueue)); active.add(running); running.then(() => active.delete(running), () => {}); } if (active.size) await Promise.race(active); } } catch (error) { await Promise.allSettled(active); throw error; }}