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