refactor: cleanup internal benchmark code
[poolifier.git] / tests / worker-files / thread / testWorker.js
... / ...
CommitLineData
1'use strict'
2const { ThreadWorker, KillBehaviors } = require('../../../lib')
3const { isMainThread } = require('worker_threads')
4const TestUtils = require('../../test-utils')
5const { WorkerFunctions } = require('../../test-types')
6
7function test (data) {
8 data = data || {}
9 data.function = data.function || WorkerFunctions.jsonIntegerSerialization
10 TestUtils.executeWorkerFunction(data)
11 return isMainThread
12}
13
14module.exports = new ThreadWorker(test, {
15 maxInactiveTime: 500,
16 killBehavior: KillBehaviors.HARD
17})