Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
text: tweetObject.full_text || tweetObject.text,
referencing_tweet: tweetObject.in_reply_to_status_id_str,
author: tweetObject.user.screen_name,
};
});
try {
if (allMentions.length) {
// for failure/recovery purposes
await cache.setAsync('lastTweetRetrieved', allMentions[allMentions.length - 1].id);
let results = await Promise.all(allMentions.map(service.handleMention));
await Promise.all(results.map(service.handleParsingResult));
}
} catch (err) {
if (err instanceof (require("redis")).ReplyError) {
console.log(`Redis error: ${err.command} ${err.args} ${err}`);
}
throw err;
}
return http.success(`Handled ${allMentions.length} tweets`);
};
function redisQuit() {
redisSub.unsubscribe();
redisSub.quit();
redisPub.quit();
redisClient.quit();
}
module.exports = {
redisPub,
redisSub,
redisClient,
updateRedisOrderAndPublish,
publishRedisMessage,
redisQuit,
ReplyError: redis.ReplyError,
};
client.on('error', function (err) {
if (err instanceof redis.ReplyError) {
console.log(`Redis error: ${err.command} ${err.args} ${err}`);
}
throw err;
});
client.authAsync(process.env.REDIS_PASSWORD);