X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fcluster%2FasyncErrorWorker.js;h=0b6f5d8acb937a02bc4dcb47d855f6a89456ddc2;hb=15d563152134452a245e4842b20fbf4030457e16;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..0b6f5d8a 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/index') +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.workerSleepFunction( + data, + 2000, + true, + 'Error Message from ClusterWorker:async' + ) } module.exports = new ClusterWorker(error, { maxInactiveTime: 500, - async: true + async: true, + killBehavior: KillBehaviors.HARD })