Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back-pressure question #88

Open
dahjelle opened this issue Jan 22, 2016 · 1 comment
Open

Back-pressure question #88

dahjelle opened this issue Jan 22, 2016 · 1 comment

Comments

@dahjelle
Copy link

I have a situation where I'm parsing a JSON stream, and for each node event, I'd like to fire off an HTTP request and get its response before pushing some data off on to a separate stream. Something like:

oboe(input_stream)
  .node({
    '!.*': function(block, [, counter]) {
      fetch(block.url).then(function(response) {
        output_stream.push(/*whatever*/);
      })
      return oboe.drop;
    }
  })
  .done(function() {
    console.log('Done reading.');
  });

But it seems that this will fire off as many HTTP requests in a row as it can without waiting for the responses, since the .node callback is technically complete right away (and the Promise resolves later).

Is there a way to indicate to oboe when the callback is actually done?

@JuanCaicedo
Copy link
Collaborator

Right now, I don't think there is, but this is probably a great feature to add since it has been asked before (#81)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants