-
Notifications
You must be signed in to change notification settings - Fork 96
give more time to workers to finish the process #89
Conversation
I think... we need a better way 😛 |
@efegurkan , what do you think? |
IMO, this is a hack that should be solved better. You should find a way to add this timeout as a flag, config etc. otherwise it will be a breaking change. |
index.js
Outdated
workerFarm.end(workers); | ||
process.removeListener('SIGINT', shutdownCallback); | ||
}).finally(function() { | ||
injectTimeout(finallCallback, 10000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a smaller number work as well? Is there any real signal that we can hook into to find out the right timeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe getting a result with any number is not guaranteed. we can try smaller numbers though.
For a signal to hook into, I think we should use the new plugin API. The done
hook would be the best choice, I presume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin is already listening to the done hook. The issue is that webpack-bundle-analyzer is set up wrongly internally, and only executing after the done hook is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pago I checked different values for the timeout and it seems it depends on the size of the stats file. I'll try to add the timeout as a flag or config.
@pago From what I've seen in the source of That said, webpack actually doesn't know that there's enqueued operations, since This 'hack' works because the farm termination is effectively delayed, and the underlying processes are essentially allowed to do whatever they want (and yes, probably executing the enqueued operations that 10 seconds should be sufficient, but imagine a hypothetical situation where a huge I might do a little bit of research/test into this again since it's pretty interesting to me why |
bin/run.js
Outdated
@@ -47,6 +47,7 @@ if(argv.version) { | |||
exclude: argv['display-exclude'], | |||
colors: argv['colors'], | |||
stats: argv['stats'], | |||
timeout: argv['timeout'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add it to the schema as well?
https://github.com/trivago/parallel-webpack/blob/master/schema.json
@byara @liangchunn Last thing I'm still wondering about is the name of the flag. |
absolutely right. I have no problem with that. If we cannot think of something shorter, I will make the changes according to |
This PR gives more time to the workers to finish before ending them.