-
Notifications
You must be signed in to change notification settings - Fork 4k
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(cli): old setInterval remains and is not cleared #32985
base: main
Are you sure you want to change the base?
Changes from 2 commits
2a31e2b
19ae427
f7726d9
fa26047
d0d410f
279f5a9
70c7b85
06322de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,13 @@ export class ProgressPrinter { | |
} | ||
|
||
public start() { | ||
// If there is already a running setInterval, clear it first. | ||
// This is because if this.setInterval is reassigned to another setInterval, | ||
// the original setInterval remains and can no longer be cleared. | ||
if (this.setInterval) { | ||
clearInterval(this.setInterval); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good find, but I'd rather see this thrown an exception saying that The problem is not that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that makes sense. |
||
this.setInterval = setInterval(() => { | ||
if (!this.isPaused) { | ||
this.print(); | ||
|
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 seems like the actual fix!