Semaphore implementation for async js operations, used for resource limit or pool implementation
5.15.0
const sem = new Semaphore(10)async call_api(payload: any) { const release = await sem.acquire() // ... // this block, will be execute with 10 concurrency limit release()} Copy
const sem = new Semaphore(10)async call_api(payload: any) { const release = await sem.acquire() // ... // this block, will be execute with 10 concurrency limit release()}
acquire a permit from sem
wait before timeout, if not set, will wait forever
release function, which used for release a permit to sem
run an async function with sem limit
async runner function
wait timeout before wait
Semaphore implementation for async js operations, used for resource limit or pool implementation