diff --git a/master.js b/master.js index f92e3dd8..6ed5e4a7 100644 --- a/master.js +++ b/master.js @@ -379,17 +379,20 @@ POST Get metadata from a single slave. For whenever you find the data returned b app.post("/api/getSlaveMeta", function (req, res) { endpointHitCounter.labels(req.route.path).inc(); console.log("body", req.body); - if(req.body && req.body.instanceID){ - if (slaves[req.body.instanceID]) { + if(req.body && req.body.instanceID){ + if (slaves[req.body.instanceID]) { console.log("returning meta for ", req.body.instanceID); + if(!slaves[req.body.instanceID].meta) { + slaves[req.body.instanceID].meta = {}; + } res.send(JSON.stringify(slaves[req.body.instanceID].meta)) } else { res.status(404) res.send('{"status": 404, "info": "Slave not registered"}') } } else { - res.status(400); - res.send('{"INVALID REQUEST":1}'); + res.status(400); + res.send('{"INVALID_REQUEST":1}'); } }); // mod management diff --git a/sharedPlugins/researchSync/index.js b/sharedPlugins/researchSync/index.js index 33b267ec..395e885a 100644 --- a/sharedPlugins/researchSync/index.js +++ b/sharedPlugins/researchSync/index.js @@ -128,7 +128,7 @@ class ResearchSync { request_cluster_data() { const slaves_data_url = `${this.config.masterIP}:${this.config.masterPort}/api/slaves` - needle.get(slaves_data_url, this.sync_researches.bind(this), {compressed:true}) + needle.get(slaves_data_url, {compressed:true}, this.sync_researches.bind(this)) } sync_researches(err, resp, slaves_data) {