Skip to content

Reset flaggedForDeletion property after query editor close & reopen #19407

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cssuh
Copy link
Contributor

@cssuh cssuh commented May 12, 2025

Currently, when we close a query editor, the associated query runner gets flagged for deletion, with a timer of 30 minutes. This flag does not get reset if we re-open the same query editor and run a query, which can lead to deletion of the query runner in the middle of a long-running query (due to the 30 minute timer) and can put the query editor in a bad state.

I have added a conditional which will reset the flaggedForDeletion property if we are re-using an existing query runner. I also added some additional logging to help with debugging in the future.

Fixes #18837

@cssuh cssuh mentioned this pull request May 12, 2025
@cssuh cssuh changed the title Prevent query runner deletion after editor close & reopen Reset flaggedForDeletion property after query editor close & reopen May 12, 2025
Copy link

PR Changes

Category Main Branch PR Branch Difference
Code Coverage 55.15% 55.02% $${\color{lightgreen} -.13\% }$$
VSIX Size 15280 KB 15295 KB $${\color{lightgreen} 15 KB \space (0\%) }$$
Webview Bundle Size 3656 KB 3656 KB $${\color{lightgreen} 0 KB \space (0\%) }$$

@@ -91,6 +93,13 @@ export default class QueryRunner {
this._vscodeWrapper = new VscodeWrapper();
}

// Setup Logger

let channel = this._vscodeWrapper.createOutputChannel(
Copy link
Member

Choose a reason for hiding this comment

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

do we need a separate logging channel? I'm wonder if it's best practice to create new output channels per feature area?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just following the convention used elsewhere in the extension, should we consolidate all the logs into one channel?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should be using vscodeWrapper.outputChannel, which will reuse the existing MSSQL one. Also, ideally adding a logging prefix to make logs easier to filter through: Logger.create(channel, "Querys") or maybe "QueryRunner"

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.

Cannot cancel long running Query.
3 participants