Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ngcc: new cluster worker entry-point #36637

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

Closed

Conversation

petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Apr 15, 2020

This refactoring simplifies the clustering by providing a new entry-point file for cluster workers.

This reduces the complexity of the code (not having to check for cluster.isMaster so much) and also removes the need to do parse and execute as much code in the worker processes.

@petebacondarwin petebacondarwin added state: WIP refactoring Issue that involves refactoring or code-cleanup comp: ngcc labels Apr 15, 2020
@ngbot ngbot bot added this to the needsTriage milestone Apr 15, 2020
@petebacondarwin petebacondarwin force-pushed the ngcc-worker-entry-point branch 4 times, most recently from 52c8f72 to 441dae7 Compare April 15, 2020 20:09
@petebacondarwin petebacondarwin added the target: patch This PR is targeted for the next patch release label Apr 15, 2020
@petebacondarwin petebacondarwin force-pushed the ngcc-worker-entry-point branch 3 times, most recently from 78c8abb to e22f60b Compare April 16, 2020 10:00
@petebacondarwin petebacondarwin marked this pull request as ready for review April 16, 2020 11:59
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: WIP labels Apr 16, 2020
@pullapprove pullapprove bot requested a review from gkalpak April 16, 2020 11:59
Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! 🎊 👌 💯

@petebacondarwin petebacondarwin added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 16, 2020
The change in e041ac6
to support sending unlocker process output to the main ngcc
console output prevents messages require that the main process
relinquishes the event-loop to allow the `stdout.on()` handler to
run.  This results in none of the messages being written when ngcc
is run in `--no-async` mode, and some messages failing to be
written if the main process is killed (e.g. ctrl-C).

It appears that the problem with Windows and detached processes
is known - see nodejs/node#3596 (comment).
But in the meantime, this commit is a workaround, where non-Windows
`inherit` the main process `stdout` while on Windows it reverts
to the async handler approach, which is better than nothing.
@petebacondarwin petebacondarwin force-pushed the ngcc-worker-entry-point branch 4 times, most recently from c3b5dfb to 9932209 Compare April 16, 2020 16:19
The `main.ts` and `worker.ts` had duplicate logic, which has now been
moved to a single function called `getSharedSetup()`.
@petebacondarwin petebacondarwin force-pushed the ngcc-worker-entry-point branch from 9932209 to ee34b76 Compare April 16, 2020 16:28
@petebacondarwin petebacondarwin added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Apr 16, 2020
@matsko matsko closed this in 2ed7146 Apr 16, 2020
matsko pushed a commit that referenced this pull request Apr 16, 2020
The change in e041ac6
to support sending unlocker process output to the main ngcc
console output prevents messages require that the main process
relinquishes the event-loop to allow the `stdout.on()` handler to
run.  This results in none of the messages being written when ngcc
is run in `--no-async` mode, and some messages failing to be
written if the main process is killed (e.g. ctrl-C).

It appears that the problem with Windows and detached processes
is known - see nodejs/node#3596 (comment).
But in the meantime, this commit is a workaround, where non-Windows
`inherit` the main process `stdout` while on Windows it reverts
to the async handler approach, which is better than nothing.

PR Close #36637
matsko pushed a commit that referenced this pull request Apr 16, 2020
matsko pushed a commit that referenced this pull request Apr 16, 2020
matsko pushed a commit that referenced this pull request Apr 16, 2020
The `main.ts` and `worker.ts` had duplicate logic, which has now been
moved to a single function called `getSharedSetup()`.

PR Close #36637
matsko pushed a commit that referenced this pull request Apr 16, 2020
matsko pushed a commit that referenced this pull request Apr 16, 2020
The change in e041ac6
to support sending unlocker process output to the main ngcc
console output prevents messages require that the main process
relinquishes the event-loop to allow the `stdout.on()` handler to
run.  This results in none of the messages being written when ngcc
is run in `--no-async` mode, and some messages failing to be
written if the main process is killed (e.g. ctrl-C).

It appears that the problem with Windows and detached processes
is known - see nodejs/node#3596 (comment).
But in the meantime, this commit is a workaround, where non-Windows
`inherit` the main process `stdout` while on Windows it reverts
to the async handler approach, which is better than nothing.

PR Close #36637
matsko pushed a commit that referenced this pull request Apr 16, 2020
matsko pushed a commit that referenced this pull request Apr 16, 2020
matsko pushed a commit that referenced this pull request Apr 16, 2020
The `main.ts` and `worker.ts` had duplicate logic, which has now been
moved to a single function called `getSharedSetup()`.

PR Close #36637
@petebacondarwin petebacondarwin deleted the ngcc-worker-entry-point branch April 16, 2020 20:28
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants