From de9bd96b5ccda3b9a354cf3e02d49012bdc177d4 Mon Sep 17 00:00:00 2001 From: schneefux Date: Tue, 4 Apr 2017 20:30:33 +0200 Subject: send jobs to compiler --- worker.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/worker.js b/worker.js index 6e4e4cb..d0d6ca0 100644 --- a/worker.js +++ b/worker.js @@ -20,6 +20,7 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI || "amqp://localhost", rabbit = await amqp.connect(RABBITMQ_URI), ch = await rabbit.createChannel(); await ch.assertQueue("compile", {durable: true}); + await ch.assertQueue("analyze", {durable: true}); break; } catch (err) { console.error(err); @@ -212,6 +213,14 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI || "amqp://localhost", console.log("acking batch"); await ch.ack(msgs.pop(), true); // ack all messages until the last + // notify analyzer + Promise.all(participant_ext_records.map(async (p) => + await ch.sendToQueue("analyze", new Buffer(p.participant_api_id), { + persistent: true, + type: "participant" + }) + )); + // notify web await Promise.all([ Promise.all(players.map(async (p) => await ch.publish("amq.topic", "player." + p.name, -- cgit v1.3.1