-
Notifications
You must be signed in to change notification settings - Fork 17
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
removed unnecessary logger #74
Conversation
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.
LGTM
Codecov Report
@@ Coverage Diff @@
## main #74 +/- ##
==========================================
- Coverage 66.93% 66.84% -0.09%
==========================================
Files 33 33
Lines 2752 2745 -7
Branches 105 105
==========================================
- Hits 1842 1835 -7
Misses 909 909
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
} | ||
else { | ||
this._fsWatcher.unwatch(oldKubeconfigPath); | ||
this._fsWatcher.add(this._currentKubeconfigPath); | ||
} | ||
} | ||
// The kubeconfig file is watched for changes, and the event is triggered when the file is changed. | ||
this._fsWatcher.on(`change`, (path) => { |
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 is interesting hence asking, moving this out means it will skip the if clause
and what was the purpose of that if clause?
Previously it was this:
So thinking outlaud as to what was the reason and extent the change was trigger impact :) no clue, in case you know what is the reason behind this. aka why previously it was cushioned with if
clause previously?
if (this._fsWatcher == null) {
this._fsWatcher = FileSystemWatcher.watch(this._currentKubeconfigPath);
this._fsWatcher.on(`change`, path => {
this._logger.trace(TelemetryEvent.AccountContextManager_KubeconfigChange);
this._kubeconfigChanged.trigger();
});
}
else {
this._fsWatcher.unwatch(oldKubeconfigPath);
this._fsWatcher.add(this._currentKubeconfigPath);
}
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.
Good question @Tatsinnit I was also surprised how this was logging 20M times being inside if condition. According to the library this code will execute whenever there is change event triggered on the directory or file path it's watching so if condition doesn't make sense and caused confusion here. so moved the code below for more readability,
this._fsWatcher.on(`change` - this will be triggered if there are changes in the kube config file ex: when you switch namespaces or switch clusters this will happen.
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.
@Tatsinnit are we good with this ? can we resolve this and merge the PR ?
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.
🎊 Sounds good, we should make sure this is well tested and wider folks are aware of this. Thank you so much. Looks Good.
This PR is to remove the logged telemetry events which aren't used much. And changed async line of code below for more readability.
KubectlClient_Command,
AccountContextManager_KubeconfigChange