Skip to content

Conversation

dignifiedquire
Copy link
Member

I've been trying to use this module with async work, but if all emits are async this breaks down. Added a failing test to show the behaviour I mean.

This fails with

# through async
not ok 3 should be equivalent
  ---
    operator: deepEqual
    expected: [ 10, 20, 30 ]
    actual:   []
    at: pull (/Users/dignifiedquire/opensource/pull-through/index.js:46:22)
  ...

@dignifiedquire
Copy link
Member Author

I'm not sure how far this is related with the Don't keep a reference to this, but I'm not seeing another way except for keeping a reference inside the writer when doing async work.

@dominictarr
Copy link
Member

I mainly wrote this module to make porting a few other through node-stream modules easy.
one solution might be to make a pull-through2 which takes a callback?

can you describe the stream you are trying to implement?
you could prehaps also use asyncMap, and then flatten?

@dignifiedquire
Copy link
Member Author

one solution might be to make a pull-through2 which takes a callback?

Yes that might be a possible solution. Maybe for now we just add note to the readme that this case is not working and asyncMap can be an alternative in those cases?

you could prehaps also use asyncMap, and then flatten?

Yes this is exactly what I ended up doing, switching to use asyncMap, as in my case I actually had a 1-1 mapping between in and out data.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants