docs: add changelog entry for IWRR worker choice strategy
[poolifier.git] / examples / yourWorker.js
... / ...
CommitLineData
1'use strict'
2const { isMainThread } = require('worker_threads')
3const { ThreadWorker } = require('poolifier')
4
5const debug = false
6
7function yourFunction () {
8 for (let i = 0; i <= 1000; i++) {
9 const o = {
10 a: i
11 }
12 JSON.stringify(o)
13 }
14 debug === true && console.log('This is the main thread ' + isMainThread)
15 return { ok: 1 }
16}
17
18module.exports = new ThreadWorker(yourFunction)