refactor: cleanup cluster ESM issue workaround
[poolifier.git] / examples / yourWorker.js
index ac3959d121f1fcfa123f1118374a1c4b3d2bcf4f..b2df8d19093527e0ca67a24f9f84589ab1207050 100644 (file)
@@ -1,14 +1,17 @@
 'use strict'
-const { ThreadWorker } = require('../lib/workers')
+const { isMainThread } = require('worker_threads')
+const { ThreadWorker } = require('poolifier')
 
-function yourFunction (data) {
+const debug = false
+
+function yourFunction () {
   for (let i = 0; i <= 1000; i++) {
     const o = {
       a: i
     }
     JSON.stringify(o)
   }
-  // console.log('This is the main thread ' + isMainThread)
+  debug === true && console.info('This is the main thread ' + isMainThread)
   return { ok: 1 }
 }