summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-05-16 12:45:43 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-05-16 12:45:43 +0200
commit899061067039105f3cd639e553bf85ae6eb5684f (patch)
tree13428bbb9ab93a039ac77eab2a99301f956f2a64
parentb33b4227b89c08f8b663351bd9513f4afa15a943 (diff)
downloadbridge-899061067039105f3cd639e553bf85ae6eb5684f.tar.gz
bridge-899061067039105f3cd639e553bf85ae6eb5684f.zip
add Telemetry dl endpoint
-rw-r--r--server.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/server.js b/server.js
index d93162e..48647f7 100644
--- a/server.js
+++ b/server.js
@@ -467,9 +467,20 @@ app.post("/api/samples", async (req, res) => {
});
// download Telemetry
app.post("/api/match/:match/telemetry", async (req, res) => {
- logger.info("requesting download for Telemetry", { api_id: req.params.api_id });
- await ch.sendToQueue(SAMPLE_QUEUE, new Buffer(req.params.api_id),
- { persistent: true, type: "telemetry" });
+ logger.info("requesting download for Telemetry", { api_id: req.params.match });
+ const asset = await model.Asset.findOne({ where: {
+ match_api_id: req.params.match
+ } });
+ if (asset == undefined) {
+ logger.error("could not find any assets for match",
+ { api_id: req.params.match });
+ res.sendStatus(404);
+ return;
+ }
+ await ch.sendToQueue(SAMPLE_QUEUE, new Buffer(JSON.stringify(asset.url)), {
+ persistent: true, type: "telemetry",
+ headers: { match_api_id: req.params.match }
+ });
res.sendStatus(204);
});
// crunch all global stats