X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fcluster%2FasyncErrorWorker.js;h=f358fc3ea409ddb987efa05a1ab38ee245afc4df;hb=b22361f4474e4a63a7482741d98f0c58b4b03b4c;hp=b9fd9016ab91801122e4cb6394b5e590377b4f3f;hpb=aad2595fd9c26bcb2f0d7a22d06edf56d5b08bdb;p=poolifier.git diff --git a/tests/worker-files/cluster/asyncErrorWorker.js b/tests/worker-files/cluster/asyncErrorWorker.js index b9fd9016..f358fc3e 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 { sleepTaskFunction } = require('../../test-utils.js') 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 + killBehavior: KillBehaviors.HARD, + maxInactiveTime: 500 })