A dynamic thread pool and a new worker implementation. Next step is to write some...
[poolifier.git] / yourWorker.js
CommitLineData
27006a3d 1'use strict'
a32e02ba 2const { ThreadWorker, DynamicWorker } = require('./lib/workers')
27006a3d 3
a32e02ba 4class MyWorker extends DynamicWorker {
27006a3d 5 constructor () {
6 super((data) => {
a32e02ba 7 for (let i = 0; i <= 10000; i++) {
8 const o = {
9 a: i
10 }
11 JSON.stringify(o)
12 }
27006a3d 13 // console.log('This is the main thread ' + isMainThread)
a32e02ba 14 return data
27006a3d 15 })
16 }
17}
18
19module.exports = new MyWorker()