summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-05-12 19:13:52 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-05-12 19:13:52 +0200
commit720c680c0902fcc3a3c56457120416a7893480d9 (patch)
treea613c3bdfa673c584b2bd7b1a78cd460e667a6ec
parentb261d7ebdcbb839abe216d5d5ac8c562504c0a1a (diff)
downloadapigrabber-release/2.3.1.tar.gz
apigrabber-release/2.3.1.zip
send matches_none on no matches for playerrelease/2.3.1
-rw-r--r--worker.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/worker.js b/worker.js
index fc66ae4..d6befcb 100644
--- a/worker.js
+++ b/worker.js
@@ -69,7 +69,7 @@ if (LOGGLY_TOKEN)
// loop over API data objects
async function getAPI(payload, where, notify="global") {
- await Promise.each(await api.requests(where,
+ const data = await Promise.each(await api.requests(where,
payload.region, payload.params, logger),
async (data, idx, len) => {
if (where == "matches") // send match structure
@@ -84,8 +84,12 @@ if (LOGGLY_TOKEN)
await ch.sendToQueue(SAMPLE_QUEUE,
new Buffer(JSON.stringify(data.attributes.URL)),
{ persistent: true, type: "sample" });
+ return data;
}
);
+ if (data.length == 0 && notify)
+ await ch.publish("amq.topic", notify,
+ new Buffer("matches_none"));
}
})();