From 81dd61bc8657c6053524fb98360cebf501cbc83b Mon Sep 17 00:00:00 2001 From: arshiam2 <arshiam2@illinois.edu> Date: Sat, 1 Dec 2018 22:06:14 -0600 Subject: [PATCH] update --- cli/src/commands/get-stream.js | 13 +++++++------ sfds/index.js | 9 +++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/cli/src/commands/get-stream.js b/cli/src/commands/get-stream.js index 2bd1aea..125c6c4 100644 --- a/cli/src/commands/get-stream.js +++ b/cli/src/commands/get-stream.js @@ -30,12 +30,13 @@ module.exports.handler = handleErrors(async (argv: {}) => { // console.log(JSON.stringify(body).state) fetch(target) .then(res => (res.text())) - .then(json => { - // // if (json.action !== "END") { - // // queue.push(json); - // // } else { - console.log(json); - // // } + .then(data => { + if (data.action !== "DONE") { + // queue.push(json); + process.exit() + } else { + console.log(data); + } }); // } diff --git a/sfds/index.js b/sfds/index.js index b0c3d67..3604b3d 100644 --- a/sfds/index.js +++ b/sfds/index.js @@ -410,7 +410,12 @@ app.post("/spout", function(req, res) { app.get("/sink", function(req, res) { // console.log("bolt state: " +req.body.state) - res.send("IM A SINK"); + if (results.length > 0) { + res.send(results.pop()); + } else { + res.send("DONE"); + } + // res.send("IM A SINK"); }); @@ -432,7 +437,7 @@ setInterval(function sync() { queue.push(json); } else { results.push(json.state) - console.log(json.state); + console.log("result: " + json.state); } }); } -- GitLab