X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fcluster%2FasyncErrorWorker.js;h=468a0ff92ce8dbedfa925eef3ed30b2d44a1e1d3;hb=563b18cd8fe9c211f15e9da91a299f2819abea01;hp=2476853b55520ab5fea4c917fb70d0f05c66dfa0;hpb=76b1e974f09148b895e52e0c96d1c8379519ff7a;p=poolifier.git diff --git a/tests/worker-files/cluster/asyncErrorWorker.js b/tests/worker-files/cluster/asyncErrorWorker.js index 2476853b..468a0ff9 100644 --- a/tests/worker-files/cluster/asyncErrorWorker.js +++ b/tests/worker-files/cluster/asyncErrorWorker.js @@ -1,16 +1,17 @@ 'use strict' -const { ClusterWorker } = require('../../../lib/index') +const { ClusterWorker, KillBehaviors } = require('../../../lib') +const { sleepTaskFunction } = require('../../test-utils') async function error (data) { - return new Promise((resolve, reject) => { - setTimeout( - () => reject(new Error('Error Message from ClusterWorker:async')), - 2000 - ) - }) + return sleepTaskFunction( + data, + 2000, + true, + 'Error Message from ClusterWorker:async' + ) } module.exports = new ClusterWorker(error, { - maxInactiveTime: 500, - async: true + killBehavior: KillBehaviors.HARD, + maxInactiveTime: 500 })