Skip to content

Reduce Publish Dialog latency #21928

Open
ssreerama wants to merge 9 commits intomainfrom
sai/apr/portSlowness
Open

Reduce Publish Dialog latency #21928
ssreerama wants to merge 9 commits intomainfrom
sai/apr/portSlowness

Conversation

@ssreerama
Copy link
Copy Markdown
Contributor

@ssreerama ssreerama commented Apr 16, 2026

Description

This PR refactors the code and improves UI loading

  • Previously, when opening the Publish Database Project dialog and switching the publish target to "New Local Docker", findAvailablePort was called on-demand, blocking the UI for ~60ms
  • This change fires findAvailablePort as a background Promiseimmediately when the command is invoked, in parallel with deployment options and dialog initialization.
  • By the time the user can interact with the dialog and switch the target dropdown, the promise is already resolved and the await returns instantly.
  • Locally tested with few unavailable port numbers, and the latency brought down from 60ms to 0.2ms, the time is minute but when we have too many unavailable ports there the loading will much faster.
  • Moved async calls into the publish dialog controller and fetching options and non allocated port inside initial Dialog

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

@ssreerama ssreerama requested a review from kburtram as a code owner April 16, 2026 16:11
Copilot AI review requested due to automatic review settings April 16, 2026 16:11
@ssreerama ssreerama self-assigned this Apr 16, 2026
@ssreerama ssreerama added this to the July 2026 Release milestone Apr 16, 2026
@ssreerama ssreerama linked an issue Apr 16, 2026 that may be closed by this pull request
17 tasks
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces perceived UI latency in the Publish Database Project dialog when switching the publish target to New Local Docker by precomputing the first available container port in the background.

Changes:

  • Preloads findAvailablePort(...) as a background Promise<number> when the publish command is invoked.
  • Threads the preloaded promise into PublishProjectWebViewController and uses it when switching to the LocalContainer publish target.
  • Falls back to a live dockerUtils.findAvailablePort(...) call when no preloaded promise is provided.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
extensions/mssql/src/controllers/mainController.ts Starts port detection early and passes the resulting promise into the publish dialog controller.
extensions/mssql/src/publishProject/publishProjectWebViewController.ts Accepts and uses a preloaded port promise to avoid blocking UI when switching to LocalContainer.

Comment thread extensions/mssql/src/publishProject/publishProjectWebViewController.ts Outdated
Comment thread extensions/mssql/src/controllers/mainController.ts Outdated
Comment thread extensions/mssql/src/publishProject/publishProjectWebViewController.ts Outdated
Comment thread extensions/mssql/src/controllers/mainController.ts Outdated
@ssreerama ssreerama changed the title Reduce Publish Dialog latency when switching to New Local Docker target Reduce Publish Dialog latency Apr 16, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 78048 KB 78048 KB ⚪ 0 KB ( 0% )
sql-database-projects VSIX 6221 KB 6221 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )
keymap VSIX 7 KB 7 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 64.61538% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.82%. Comparing base (89576e9) to head (b0a5b77).

Files with missing lines Patch % Lines
.../publishProject/publishProjectWebViewController.ts 64.61% 23 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #21928      +/-   ##
==========================================
- Coverage   74.83%   74.82%   -0.01%     
==========================================
  Files         392      392              
  Lines      118948   118989      +41     
  Branches     7065     7069       +4     
==========================================
+ Hits        89015    89039      +24     
- Misses      29933    29950      +17     
Flag Coverage Δ
data-workspace 77.10% <ø> (ø)
mssql 74.50% <64.61%> (-0.01%) ⬇️
sqlproj 77.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
extensions/mssql/src/controllers/mainController.ts 35.79% <ø> (+0.04%) ⬆️
.../publishProject/publishProjectWebViewController.ts 71.54% <64.61%> (-0.47%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comment thread extensions/mssql/test/unit/publishProjectWebViewController.test.ts
Copilot AI review requested due to automatic review settings April 23, 2026 15:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread extensions/mssql/src/publishProject/publishProjectWebViewController.ts Outdated
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.

[Bug]: Improve Publish Database Project dialog launch latency

4 participants