Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var search = (body ? (match(body)): false);
if(search){
console.log('Found '+keyword);
$ = cheerio.load(body); // html of paste page
raw = $('#paste_code').eq(0).html(); // raw paste content
console.log('pastebin.com'+response.request.url.pathname); // url of paste
}
return false;
});
}
else {
console.log("Skipped URL: "+url);
}
}
sleep.sleep(frequency.wait);
}
});
};
async.mapLimit(commits, 1, async function (commit) {
const response = await requestChainSo(commit.txId, commit.txIndex)
require('sleep').sleep(10) // do not overload chain.so
return response
}, (err, blockchainResults) => {
// We have gathered all the data from the api
function checkVariable() {
if (current_total == true && current_sent == true && current_rec == true) {
return;
} else {
// Just in case
sleep.sleep(1);
}
}
setTimeout(checkVariable, 1000);
router.get('/login', function(req, res) {
// Simulate latency
sleep.sleep(3)
//pretend this reqeust is valid
let valid = true
if( valid ) {
res.status(200).send({
token: token('vue'),
refresh: token('vue')
})
}
})
}, function (err, subscriber) {
should.not.exist(err);
should.exist(subscriber);
should.exist(subscriber.getDetails);
testSubscriber = subscriber;
// This timeout is necessary. CM adds subscribers async so we need to wait from them to catch up.
isIntegrationTest && sleep.sleep(2);
done();
});
});
}, function (err, subscriber) {
should.not.exist(err);
should.exist(subscriber);
should.exist(subscriber.getDetails);
testSubscriber = subscriber;
// This timeout is necessary. CM adds subscribers async so we need to wait from them to catch up.
isIntegrationTest && sleep.sleep(1);
done();
});
});
test('cache(...args) execute the handler twice with 3 requests', async t => {
const handler = sinon.stub()
handler.onCall(0).returns(1)
handler.onCall(1).returns(2)
const microFn = await cache(1000, handler)
const req = { url: 'https://someapi.com' }
t.is(1, await microFn(req))
t.is(1, await microFn(req))
await sleep(1)
t.is(2, await microFn(req))
t.is(2, handler.callCount)
})
});
child.on('exit', function (code, signal) {
if (code === 0) {
console.log('[Node:worker] Child exited normaly (' + code + ')')
} else {
console.log('[Node:worker] Child process terminated with code ' + code + ', signal: ' + signal);
}
child.stdin.end();
child = undefined;
frontSocket.send([channel, JSON.stringify({'time': new Date(), 'type': 'acknowledgment', 'msg': code})]);
});
console.log(process.pid + ' - ' + process.title + ': Spawned child pid: ' + child.pid);
console.log('[Node:worker] Running worker: ' + script)
require('sleep').sleep(5);
if ('configuration' in parameters) {
console.log('[Node:worker] Sending configuration to worker...');
backSocket.send(JSON.stringify(parameters.configuration))
//backSocket.send(JSON.stringify({algorithm: parameters.algorithm, manager: parameters.manager, done:true}))
}
process.on("SIGTERM", function() {
console.log("[Node:worker] Parent SIGTERM detected");
backSocket.close();
process.exit();
});
process.on("SIGINT", function() {
console.log("[Node:worker] Signal SIGINT detected");
backSocket.close();
}, () => {
console.log(chalk.green('The relay node has been started.'))
sleep(1)
onCancel()
})
}
stopProcess('ark-core:relay-and-forger', () => {
console.log(chalk.bgRed('The relay node and forger have been stopped.'))
sleep(1)
onCancel()
})
}