X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fcluster%2FasyncErrorWorker.js;h=fba8423f4f46dec5e7c169d5316b82e5b3b2056e;hb=5931725336d0de8a06146641ae6feef22bf60e6e;hp=b9fd9016ab91801122e4cb6394b5e590377b4f3f;hpb=e901162fa610e2af305aac504549580b2de48cab;p=poolifier.git diff --git a/tests/worker-files/cluster/asyncErrorWorker.js b/tests/worker-files/cluster/asyncErrorWorker.js index b9fd9016..fba8423f 100644 --- a/tests/worker-files/cluster/asyncErrorWorker.js +++ b/tests/worker-files/cluster/asyncErrorWorker.js @@ -1,17 +1,17 @@ 'use strict' -const { ClusterWorker, KillBehaviors } = 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, killBehavior: KillBehaviors.HARD })