summaryrefslogtreecommitdiff
path: root/worker.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-09 18:22:17 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-09 18:22:17 +0200
commite00120259fb2eb637ec1dd7531a8a69394a8ef86 (patch)
tree3fa3887eafa17d51c1ed5465c9f094f8c2c66587 /worker.js
parentaff563f77d7a6533ada36757e77879a0b996e32d (diff)
downloadprocessor-e00120259fb2eb637ec1dd7531a8a69394a8ef86.tar.gz
processor-e00120259fb2eb637ec1dd7531a8a69394a8ef86.zip
notify cruncher
Diffstat (limited to 'worker.js')
-rw-r--r--worker.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/worker.js b/worker.js
index fd9a138..6b5cb0b 100644
--- a/worker.js
+++ b/worker.js
@@ -23,6 +23,7 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI,
rabbit = await amqp.connect(RABBITMQ_URI);
ch = await rabbit.createChannel();
await ch.assertQueue("process", {durable: true});
+ await ch.assertQueue("crunch", {durable: true});
await ch.assertQueue("analyze", {durable: true});
break;
} catch (err) {
@@ -318,13 +319,19 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI,
if (match_records.length > 0)
await ch.publish("amq.topic", "global", new Buffer("matches_update"));
- // notify analyzer
+ // notify analyzer & cruncher
Promise.all(participant_stats_records.map(async (p) =>
await ch.sendToQueue("analyze", new Buffer(p.participant_api_id), {
persistent: true,
type: "participant"
})
));
+ Promise.all(player_records.map(async (p) =>
+ await ch.sendToQueue("crunch", new Buffer(p.api_id), {
+ persistent: true,
+ type: "player"
+ })
+ ));
}
// Split participant API data into participant and participant_stats