X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fcluster%2FasyncErrorWorker.js;h=02daa5b5a1f3ee77d1eab04a5dcbc281bc0dd639;hb=73db65c0c7af9778bec7529fd80a66bca647d8b2;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..02daa5b5 100644 --- a/tests/worker-files/cluster/asyncErrorWorker.js +++ b/tests/worker-files/cluster/asyncErrorWorker.js @@ -1,13 +1,14 @@ 'use strict' 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.sleepWorkerFunction( + data, + 2000, + true, + 'Error Message from ClusterWorker:async' + ) } module.exports = new ClusterWorker(error, {