-
-
Notifications
You must be signed in to change notification settings - Fork 197
Do not break CLI process in case analytics fail #3197
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
Conversation
const helpers = require("../../../lib/common/helpers"); | ||
const originalIsInteractive = helpers.isInteractive; | ||
|
||
const trackFeatureUsage = "TrackFeatureUsage"; |
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 could be extracted to constants and reused in here
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 disagree - the purpose here is to use it for the tests, it could easily be named in other way.
broker.unref(); | ||
|
||
let isSettled = false; | ||
try { |
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 don't believe this try { ... } catch (ex) { ... }
statement will manage to actually catch anything. More likely you'd get an unhandled rejection if something throw
s inside the new Promise
const originalSetTimeout = setTimeout; | ||
childProcess.spawn = (command: string, args?: string[], options?: any): any => { | ||
opts.isChildProcessSpawned = true; | ||
const spawnedProcess = new EventEmitter(); |
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.
Getting this spawnedProcess
can be extracted into a function - along with setting its stdout
, stderr
and unref
methods
run ci |
552abaf
to
f0bbdc7
Compare
In case we are unable to start the Analytics Broker process, CLI will fail. But analytics errors should not break user's workflow, so catch the error and ensure the actions will continue. Add tests to verify the behavior.
f0bbdc7
to
1215d43
Compare
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.
Looks okay to me
In case we are unable to start the Analytics Broker process, CLI will fail. But analytics errors should not break user's workflow, so catch the error and ensure the actions will continue. Add tests to verify the behavior.
In case we are unable to start the Analytics Broker process, CLI will fail. But analytics errors should not break user's workflow, so catch the error and ensure the actions will continue.
Add tests to verify the behavior.
Also limit the waiting for broker to start to 10 seconds.