https://github.com/fabiosantoscode/compatible-pool
https://github.com/fabiosantoscode/compatible-pool
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fabiosantoscode/compatible-pool
- Owner: fabiosantoscode
- License: mit
- Created: 2018-11-03T15:01:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T04:30:21.000Z (about 3 years ago)
- Last Synced: 2025-02-26T00:22:21.626Z (11 months ago)
- Language: JavaScript
- Size: 247 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# compatible-pool
[](https://travis-ci.org/fabiosantoscode/compatible-pool) [](https://coveralls.io/github/fabiosantoscode/compatible-pool?branch=master)
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.