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

Prevent tasks from interfering with other tasks #364

Closed
yocontra opened this issue Mar 20, 2014 · 5 comments
Closed

Prevent tasks from interfering with other tasks #364

yocontra opened this issue Mar 20, 2014 · 5 comments

Comments

@yocontra
Copy link
Member

Scenario:

  • You run two tasks - minify-css, minify-js
  • minify-js is processing a file and blocks the event loop since the underlying module (let's say uglify) is full of nested loops that take forever
  • minify-css is stalled because the main event loop is blocked
  • minify-js finishes the file
  • minify-css starts processing its file asynchronously like it's supposed to
  • minify-js gets another file and blocks the event loop again, thus stalling minify-css until it's done
  • minify-js finished before minify-css ever gets through the first file
  • minify-css shows up as taking way longer than it should have

tl;dr shitty 3rd party modules that run synchronously (like uglify) will block the main loop preventing other things from running

@narqo
Copy link

narqo commented Apr 20, 2014

Doesn't running this synchronous modules in a child process solve this?

@yocontra
Copy link
Member Author

@narqo There are a few ways to emulate threading in node.js

I'm not sure about the threading implementations but the child process route is definitely prohibitive as they can take up to 30ms to spin up

@yocontra
Copy link
Member Author

yocontra commented Sep 1, 2014

cc @phated feasibility for wrapping task fns in undertaker with threads?

@phated
Copy link
Member

phated commented Sep 4, 2014

no idea and it won't make sense to do until node 0.12 when we have contexts as contributed by github for atom editor. btw, gulp4 will nextTick everything, not sure if that will help at all.

@heikki
Copy link
Contributor

heikki commented Feb 14, 2015

Closing in favor of #317

@heikki heikki closed this as completed Feb 14, 2015
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