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

Add ability to run sync tasks #26

Open
satazor opened this issue Dec 8, 2012 · 10 comments
Open

Add ability to run sync tasks #26

satazor opened this issue Dec 8, 2012 · 10 comments

Comments

@satazor
Copy link
Member

satazor commented Dec 8, 2012

We could provide something similar to mocha. If the callback has a next, we assume it async, otherwise we call next under the hood.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/98463-add-ability-to-run-sync-tasks?utm_campaign=plugin&utm_content=tracker%2F39683&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F39683&utm_medium=issues&utm_source=github).
@satazor
Copy link
Member Author

satazor commented Dec 9, 2012

Note that if we do this, sync tasks would need to throw errors instead of doing next(err).

@sindresorhus
Copy link

👍 Mocha style!

@marcooliveira
Copy link
Member

Not sure if I agree with this one. Afraid this might create a tendency for people to make sync tasks. Not sure if the gain justifies the risk. Plus, the multiple syntax can become confusing for people trying to read the task.

@satazor
Copy link
Member Author

satazor commented Feb 2, 2013

There is one good reason to not support thi. We have plans to support running parallel tasks in the future and, as @marcooliveira said, if people start making sync tasks then they won't benefit from it.

@satazor
Copy link
Member Author

satazor commented Feb 2, 2013

Having this in mind, @mklabs and @sindresorhus can you give us your feedback?

@millermedeiros
Copy link

Most of my build tasks are synchronous, people will abuse the feature but that's a good thing, a flexible system should allow people to do bad things if they will.

You can still run things like if they were in "parallel", if the task is synchronous they just won't benefit from the perf boost.

@satazor
Copy link
Member Author

satazor commented Feb 2, 2013

Just wanted to add that if people want to make their tasks sync, they just need to call next() at the end of the task.
Errors thrown within would still be caught and handled just like next(err) was called.

@millermedeiros
Copy link

Less boilerplate == happy user :D

@marcooliveira
Copy link
Member

I agree with @satazor on this. Even though it can make some users unhappy, it's a minor annoyance if it will make the community come up with richer tasks, that can leverage great features, like parallel tasks.

@sindresorhus
Copy link

I know @mklabs loves his async. I however don't, but I do see your argument about parallel tasks. I think extra speed for the task users is worth a tiny bit of extra hassle for the task authors.

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

4 participants