When I run this:
import { Pool } from 'node-multiprocess'
async function main () {
const pool = new Pool(4)
async function worker (x) {
return new Promise( (resolve, reject) => {
resolve(x * x)
})
}
const workQ = []
for (let i = 1; i < 6; i++) {
const res = pool.addJob(await worker, i)
workQ.push(res)
}
const results = await Promise.all(workQ)
results.forEach(result => console.log(result))
pool.kill()
}
main()
I get a bunch of empty opbjects {} which are I assume the unfulfilled promises.
When I run this:
I get a bunch of empty opbjects
{}which are I assume the unfulfilled promises.