Ligth number of threads
[poolifier.git] / tests / testWorker.js
CommitLineData
506c2a14 1'use strict'
2const { ThreadWorker } = require('../lib/workers')
3const { isMainThread } = require('worker_threads')
4
5class MyWorker extends ThreadWorker {
6 constructor () {
7 super((data) => {
8 for (let i = 0; i <= 100; i++) {
9 const o = {
10 a: i
11 }
12 JSON.stringify(o)
13 }
14 return isMainThread
15 }, { maxInactiveTime: 1000 })
16 }
17}
18
19module.exports = new MyWorker()