diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-06-13 14:59:45 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-06-13 14:59:45 +0200 |
| commit | 120a0670c47acbe5541e5996230e08e36ea4f2a6 (patch) | |
| tree | eb9fde9b234729fc4a71452f3fd7e8db1bb6b798 | |
| parent | 1701b457d7adab467e1d60738039fa3cedf434fa (diff) | |
| download | processor-120a0670c47acbe5541e5996230e08e36ea4f2a6.tar.gz processor-120a0670c47acbe5541e5996230e08e36ea4f2a6.zip | |
fix silent match duplication
| -rw-r--r-- | worker.js | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -166,14 +166,16 @@ function flatten(obj) { const match = JSON.parse(msg.content); // deduplicate and reject immediately if (await model.Match.count({ where: { api_id: match.id } }) > 0) { - // send match_dupe to web player.ign.api_id - await ch.publish("amq.topic", - msg.properties.headers.notify + "." + match.id, - new Buffer("match_dupe")) - await ch.nack(msg, false, false); // discard - return; - } - match_data.add(match); + if (msg.properties.headers.notify != undefined) { + await ch.publish("amq.topic", + msg.properties.headers.notify, + new Buffer("matches_dupe")) + // send match_dupe to web player.ign.api_id + await ch.publish("amq.topic", + msg.properties.headers.notify + "." + match.id, + new Buffer("match_dupe")) + } + } else match_data.add(match); msg_buffer.add(msg); } if (msg.properties.type == "telemetry") { @@ -783,6 +785,7 @@ function flatten(obj) { // new match if (m.properties.type == "match") { notif = "matches_update"; + // TODO this sends match_update for every match in the batch to every player // notify player.name.api_id about match_update await Promise.map(match_records, async (mat) => await ch.publish("amq.topic", |
