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

fix: always ensure tracing is off before starting #2279

Merged
merged 5 commits into from
May 25, 2017

Conversation

patrickhulce
Copy link
Collaborator

fixes #2272

@@ -46,15 +46,16 @@ class Connection {
* Call protocol methods
* @param {!string} method
* @param {!Object} params
* @param {boolean=} silent
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

open to much better names, silenceError felt like it would supress the error itself, silenceErrorLogging too verbose?

endTraceIfStarted() {
return new Promise((resolve) => {
const traceCallback = () => resolve();
this.once('Tracing.tracingComplete', traceCallback);
Copy link
Member

Choose a reason for hiding this comment

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

why listen here? what about

this.sendCommand('Tracing.end').then(resolve, resolve);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nah it moves on too quickly and still fails fatally with tracing already started, this seemed preferable to an arbitrary timeout

* @return {!Promise}
*/
sendCommand(method, params) {
sendCommand(method, params, silent) {
Copy link
Member

Choose a reason for hiding this comment

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

im not crazy about the boolean trap here. do we need this at all if we follow my idea below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah regardless of that change the connection is currently hard coded for all messages with an error property to log them even if you don't care about the promise resolution

Copy link
Member

Choose a reason for hiding this comment

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

the boolean trap is pretty gnarly. Before we hardcoded some error message to ignore it...we could do the same again. There could also be some kind of log trickery so that this call to sendCommand could silence an error it was expecting then turn the silencing off again. Pretty hacky ideas, though...

@patrickhulce
Copy link
Collaborator Author

@paulirish @brendankenny switched away from bool PTAL :)

* @return {!Promise}
*/
sendCommand(method, params = {}) {
sendCommand(method, params = {}, options = {}) {
Copy link
Member

Choose a reason for hiding this comment

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

sg, but can rename to cmdOpts or something? so it's clear this is different from our beloved options friend?

Copy link
Member

Choose a reason for hiding this comment

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

Should also document it, not just it takes some options :)

Wonder if it should be something like a regex so it's not just unconditionally ignoring errors. That would resemble the temporary fix we had for silencing domain enable/disable errors, which seemed like a good idea at the time

@brendankenny
Copy link
Member

wdyt about ignoreErrorPattern or something instead of silent?

@patrickhulce
Copy link
Collaborator Author

wdyt about ignoreErrorPattern or something instead of silent?

I think it's a slightly better bandaid for the situation at hand but introduces unnecessary complexity for something we want to get rid of in forthcoming catharsis :)

@brendankenny
Copy link
Member

Wait, what are we removing that would fix the underlying problem? Or are you saying this is a temporary fix for something we want to actually fix?

@patrickhulce
Copy link
Collaborator Author

Wait, what are we removing that would fix the underlying problem?

Oh that the connection class tries to do anything more than verbose logging to begin with! Isn't that what you were proposing anyway?

@paulirish
Copy link
Member

let's wrap this guy up. i'm OK with merging and giving it a go.. see what happens.

to you, @brendankenny

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.

Yeah, I'm good with this. Let's try it out.

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.

Fix the "tracing already started" bug
3 participants