summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-13 13:04:22 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-13 13:04:22 +0200
commit4b718a352f4b78efb25d9a285ccb77bbb0cfdcd3 (patch)
tree0a054d2b4134ffb4d708df4f9427060740701ebb
parent78273446460c7b4d94060f70255ba244ac40bb33 (diff)
downloadshrinker-4b718a352f4b78efb25d9a285ccb77bbb0cfdcd3.tar.gz
shrinker-4b718a352f4b78efb25d9a285ccb77bbb0cfdcd3.zip
notifications to web: send to player.name not to player.id
-rw-r--r--worker.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/worker.js b/worker.js
index cbeb311..088ac5f 100644
--- a/worker.js
+++ b/worker.js
@@ -282,7 +282,7 @@ function snakeCaseKeys(obj) {
if (processed_players.indexOf(p.player.api_id)) {
processed_players.push(p.player.api_id);
player_records.push(p.player);
- notify_players.push(p.player.api_id);
+ notify_players.push(p.player);
}
p.participant_items.forEach((i) => {
participant_item_records.push(i);
@@ -382,11 +382,11 @@ function snakeCaseKeys(obj) {
// notify web
// …about new matches
- await Promise.all(notify_players.map(async (api_id) =>
- await ch.publish("amq.topic", "player." + api_id, new Buffer("matches_update")) ));
+ await Promise.all(notify_players.map(async (player) =>
+ await ch.publish("amq.topic", "player." + player.name, new Buffer("matches_update")) ));
// …about updated lifetime stats
await Promise.all(player_objects.map(async (api_player) =>
- await ch.publish("amq.topic", "player." + api_player.id, new Buffer("stats_update")) ));
+ await ch.publish("amq.topic", "player." + api_player.attributes.name, new Buffer("stats_update")) ));
// …global about new matches
if (match_records.length > 0)
await ch.publish("amq.topic", "global", new Buffer("matches_update"));
@@ -398,9 +398,9 @@ function snakeCaseKeys(obj) {
type: "participant"
})
));
- Promise.all(notify_players.map(async (api_id) => {
- if (PREMIUM_FEATURES == false || premium_users.indexOf(api_id) != -1) {
- await ch.sendToQueue("crunch", new Buffer(api_id), {
+ Promise.all(notify_players.map(async (player) => {
+ if (PREMIUM_FEATURES == false || premium_users.indexOf(player.api_id) != -1) {
+ await ch.sendToQueue("crunch", new Buffer(player.api_id), {
persistent: true,
type: "player"
})