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

Does es.join work in the browser? #36

Closed
amiorin opened this Issue Aug 9, 2013 · 5 comments

Comments

Projects
None yet
2 participants
@amiorin

amiorin commented Aug 9, 2013

It looks it doesn't...
http://requirebin.com/?gist=6192567

I would expect that es.join gives me the body of each hyperquest.

@dominictarr

This comment has been minimized.

Owner

dominictarr commented Aug 9, 2013

Sorry, I'm not sure what the problem is here,
I can see output, but I'm not sure what the difference is from what you expect to happen, can you describe in more detail what you expect and what you see?

@amiorin

This comment has been minimized.

amiorin commented Aug 9, 2013

I would expect to see three times this output :

err: null
text: <!DOCTYPE HTML> ...

Sometimes I get :

err: null
text:
err: null
text:
err: null
text: <!DOCTYPE HTML> ...

and sometime only :

err: null
text: <!DOCTYPE HTML> ...
@amiorin

This comment has been minimized.

amiorin commented Aug 9, 2013

I'm trying with request instead of hyperquest.

@dominictarr

This comment has been minimized.

Owner

dominictarr commented Aug 9, 2013

oh, I see the problem:

problem is probably that you are creating streams inside of step.
do this instead:

step(function () {
  hyperquest.get('/').pipe(es.join(this.parallel()))
  hyperquest.get('/').pipe(es.join(this.parallel()))
  hyperquest.get('/').pipe(es.join(this.parallel()))
}, function (err, a, b, c) {
  //I think this will work...
  console.log(err, a, b, c)
})

The problem is that it was collecting streams into an array, but some of them had actually finished by the time that they get passed to the callback and piped. You need to pipe a (classic stream, 0.8 style) on the first tick after it is created.

This way pipes the stream immediately, and just collects the results with step.

@amiorin

This comment has been minimized.

amiorin commented Aug 9, 2013

Thank you very much!

@amiorin amiorin closed this Aug 9, 2013

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