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

Async vs Sync Task creation #4

Closed
thejmazz opened this Issue Jun 30, 2016 · 2 comments

Comments

2 participants
@thejmazz
Copy link
Member

thejmazz commented Jun 30, 2016

  • duplexify with async globby and set read/write stream later - didnt convert globby to promise yet, but tested async with setTimeout

Failed all test cases when I switched task from being a sync function to a co.wrap(function * (){ .. }) - which returns a promise, but is nice because yielding promises is nice.

Before:

const task = Task(...)
isStream(task) // true

after:

const task = Task(...)
task.then((stream) => isStream(stream) /* true */ )

The reason it became async is for globby - I am checking the filesystem to see which files exist that match patterns in input and output. This may become negligible as tasks become able to pass values to each other. However, perhaps the performance impact of globby.sync will not be negligible when running many tasks, or tasks that have many files.

For now, I am just going to use globby.sync. As well, glob-stream may be worth a try - will still be async but perhaps glob-stream can be piped into the main Task stream.

At some point, Task may need to have a stream that wraps a stream. So that you can stream in input object into, and stream out an output info object on a .end after the .end/.push(null) of the inner stream.

thejmazz added a commit that referenced this issue Jun 30, 2016

thejmazz added a commit that referenced this issue Jun 30, 2016

@thejmazz

This comment has been minimized.

Copy link
Member Author

thejmazz commented Jun 30, 2016

As per de803d2, instead of wrapping the inner stream with an outer task stream (and then using a end to declare last item) I opted for just using the events API and emitting a custom event. then the join method can pick up on this and pass it on to the next task, or just call the next task

@thejmazz thejmazz referenced this issue Jun 30, 2016

Closed

Passing output from last task into new task #5

1 of 1 task complete
@thejmazz

This comment has been minimized.

Copy link
Member Author

thejmazz commented Jul 1, 2016

duplexify with placeholder (set read/write later)

@thejmazz thejmazz added this to the v0.2 milestone Jul 4, 2016

@thejmazz thejmazz closed this Jul 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.