diff --git a/cli/src/commands/get-stream.js b/cli/src/commands/get-stream.js index 2bd1aea68244d3153aeb2f99331002fc7ab89baf..125c6c4959468fbc2e27f085047e1d17e70ba247 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 b0c3d677b8380ffc0ddc26b512d1340605e22a63..3604b3d42809f4b8cbeae40d8000c1c5f50d124a 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); } }); }