Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function executeWorker(args={}) {
let {workerName = null, accountLoginFile = null, timeout = Infinity, extraParameters = {}} = args;
timeout = timeout * 1000;
let worker = workerFarm.threaded({maxCallTime: timeout},require.resolve(process.env.PWD+'/bots/workers/'+ workerName +'.js'));
return new Promise(function(resolve, reject) {
worker(accountLoginFile, function(err, result) {
workerFarm.end(worker);
resolve(result);
});
});
}