build: switch default to ESM
[poolifier.git] / tests / worker-files / cluster / asyncErrorWorker.cjs
diff --git a/tests/worker-files/cluster/asyncErrorWorker.cjs b/tests/worker-files/cluster/asyncErrorWorker.cjs
new file mode 100644 (file)
index 0000000..022b453
--- /dev/null
@@ -0,0 +1,17 @@
+'use strict'
+const { ClusterWorker, KillBehaviors } = require('../../../lib/index.cjs')
+const { sleepTaskFunction } = require('../../test-utils.cjs')
+
+async function error (data) {
+  return sleepTaskFunction(
+    data,
+    2000,
+    true,
+    'Error Message from ClusterWorker:async'
+  )
+}
+
+module.exports = new ClusterWorker(error, {
+  killBehavior: KillBehaviors.HARD,
+  maxInactiveTime: 500
+})