Fix strategy handling in pool options (#259)
[poolifier.git] / benchmarks / internal / cluster / fixed.js
... / ...
CommitLineData
1const {
2 FixedClusterPool,
3 WorkerChoiceStrategies
4} = require('../../../lib/index')
5const { runPoolifierTest } = require('../benchmark-utils')
6
7const size = 30
8const numberOfTasks = 1
9
10const fixedPool = new FixedClusterPool(
11 size,
12 './benchmarks/internal/cluster/worker.js'
13)
14
15const fixedPoolLessRecentlyUsed = new FixedClusterPool(
16 size,
17 './benchmarks/internal/cluster/worker.js',
18 { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED }
19)
20
21async function fixedClusterTest (
22 { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
23) {
24 return runPoolifierTest(fixedPool, { tasks, workerData })
25}
26
27async function fixedClusterTestLessRecentlyUsed (
28 { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
29) {
30 return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData })
31}
32
33module.exports = { fixedClusterTest, fixedClusterTestLessRecentlyUsed }