})
})
await pool.destroy()
- await new Promise(resolve => setTimeout(resolve, 200))
+ await new Promise(resolve => setTimeout(resolve, 500))
expect(closedWorkers).toBe(numberOfWorkers)
})
pool.execute({ test: 'test' })
}
expect(pool.workers.length).toBe(max)
- await new Promise(resolve => setTimeout(resolve, 1000))
+ await new Promise(resolve => setTimeout(resolve, 1500))
expect(pool.workers.length).toBe(min)
})
longRunningPool.execute({ test: 'test' })
}
expect(longRunningPool.workers.length).toBe(max)
- await new Promise(resolve => setTimeout(resolve, 1000))
+ await new Promise(resolve => setTimeout(resolve, 1500))
expect(longRunningPool.workers.length).toBe(min)
})
longRunningPool.execute({ test: 'test' })
}
expect(longRunningPool.workers.length).toBe(max)
- await new Promise(resolve => setTimeout(resolve, 1000))
+ await new Promise(resolve => setTimeout(resolve, 1500))
// Here we expect the workers to be at the max size since that the task is still running
expect(longRunningPool.workers.length).toBe(max)
})