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

Guard against launching multiple Chrome processes #1436

Merged
merged 3 commits into from
Jan 12, 2017

Conversation

Janpot
Copy link
Contributor

@Janpot Janpot commented Jan 7, 2017

No description provided.

@wardpeet
Copy link
Collaborator

wardpeet commented Jan 8, 2017

LGTM 😄 just a question when did you have this issue? ^^

@Janpot
Copy link
Contributor Author

Janpot commented Jan 8, 2017

@wardpeet Not in lighthouse. Subclassing this ChromeLauncher in my own code. Got this issue because I assumed run would guard against this behaviour. I was using run as a substitute for (run if not yet running + waitUntilReady) in multiple places.

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM3. One small suggestion; feel free to weigh in either way on it and we can merge

@@ -136,6 +136,11 @@ class ChromeLauncher {

spawn(execPath: string): Promise<any[]> {
return new Promise((resolve, reject) => {
if (this.chrome) {
log.verbose('ChromeLauncher', `Chrome already running with pid ${this.chrome.pid}.`);
Copy link
Member

Choose a reason for hiding this comment

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

maybe use log.warn? Seems like an unusual situation that in most cases you'd want to know your use of launcher is trying to launch chrome twice

Copy link
Member

Choose a reason for hiding this comment

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

(the tradeoff being that it adds warning noise to a use case like your own. A compromise might be just log.log)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's all the same for me, I just took whatever was underneath. Just let me know what you prefer

@Janpot
Copy link
Contributor Author

Janpot commented Jan 12, 2017

@brendankenny Changed to log.log

@wardpeet wardpeet merged commit 2a0a8d0 into GoogleChrome:master Jan 12, 2017
@Janpot Janpot deleted the multiple-processes-guard branch January 12, 2017 22:55
andrewrota pushed a commit to andrewrota/lighthouse that referenced this pull request Jan 13, 2017
* Guard against launching multiple Chrome processes

* Change verbosity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants