-
Notifications
You must be signed in to change notification settings - Fork 510
Clean up WaitForSessionFile logic and support increasing timeout with warning #2653
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
Clean up WaitForSessionFile logic and support increasing timeout with warning #2653
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.
Really like this implementation. The code looks good, but just want to go over the details of the settings before we merge
package.json
Outdated
@@ -761,6 +761,11 @@ | |||
"default": null, | |||
"description": "An array of strings that enable experimental features in the PowerShell extension." | |||
}, | |||
"powershell.developer.waitForSessionFileNumOfTries": { |
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.
As a setting I think it would make more sense to expose a timeout and then in the implementation just retry until the total exceeds the timeout
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 like that. Perhaps powershell.developer.sessionStartupTimeout
?
src/process.ts
Outdated
return reject(error); | ||
} | ||
// This is used to warn the user that the extension is taking longer than expected to startup. | ||
const warnUserThreshold = numOfTries / 2; |
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.
For the warning, I'd imagine our standard expectation for startup time is a constant, like 30 seconds, rather than parameterised by the setting
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} | ||
|
||
private async waitForSessionFile(): Promise<utils.IEditorServicesSessionDetails> { |
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.
Thank you! We've been using async/await in our Electron/Angular app code base and vastly prefer it to dealing with Promises directly. :-)
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 other than I like the suggestion to switch to a timeout setting instead of numTries.
Moved to seconds in the timeout, also changed the warning to call out "privilege enforcement software" as that seems to be the culprit in the issue. |
PR Summary
fixes #2526
This does 3 things:
powershell.developer.waitForSessionFileNumOfTries
to modify the 120 valueNote: I needed to move this function from utils.ts into process.ts because utils.ts is also used in debugAdapter.ts which can't use the
vscode
node_module.PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
x
between the square brackets.Please mark anything not applicable to this PR
NA
.WIP:
to the beginning of the title and remove the prefix when the PR is ready