1.0.1 • Published 6 years ago

compatible-pool v1.0.1

Weekly downloads
11
License
MIT
Repository
github
Last release
6 years ago

compatible-pool

Build Status Coverage Status

Runs a map function on a set of values. The function will run on as many processors your machine has, or on max processes.

new Pool({ max: number, create: async () => res, destroy: res => (destroys res) })

  • max: maximum number of parallel processes
  • create: return your resource here as a promise
  • destroy: destroy your resource

pool.acquire() -> Promise

Aquire a resource from the pool. This can take longer if the maximum number of processes has been reached.

pool.release(res)

Release a resource in the pool.

pool.clear()

Clear everything in the pool.