Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stream.on('data', (player) => {
if (!player.account_id || player.account_id === constants.anonymous_account_id)
{
return;
}
conc += 1;
if (conc > 5)
{
stream.pause();
}
request(config.ROOT_URL + '/api/players/' + player.account_id, (err, resp, body) => {
if (err || resp.statusCode !== 200)
{
console.error('error: %s', err || resp.statusCode);
}
console.log(player.account_id);
setTimeout(() => {
stream.resume();
function insertPlayerMatch(pm, cb) {
if (pm.account_id === constants.anonymous_account_id) {
delete pm.account_id;
}
const obj2 = serialize(pm);
const query2 = 'INSERT INTO player_matches JSON ?';
cassandra.execute(query2, [JSON.stringify(obj2)],
{
prepare: true,
}, cb);
}
}