Skip to content

[PM-38271] Speed up load org data by running queries in parallel - #8202

Open
JaredScar wants to merge 1 commit into
mainfrom
ac/pm-38271-login--load-org-data-faster-by-running-two-queries-in-parallel
Open

[PM-38271] Speed up load org data by running queries in parallel#8202
JaredScar wants to merge 1 commit into
mainfrom
ac/pm-38271-login--load-org-data-faster-by-running-two-queries-in-parallel

Conversation

@JaredScar

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-38271

📔 Objective

Speeds up getting Org data by running queries in parallel rather than one after another.

…rent data retrieval

Refactor the GetUser method to use Task.WhenAll for concurrent execution of organization retrieval and claiming user data, improving performance and reducing wait time for asynchronous operations.
@JaredScar
JaredScar requested a review from a team as a code owner August 13, 2026 15:49
@JaredScar JaredScar added the ai-review Request a Claude code review label Aug 13, 2026
@JaredScar
JaredScar requested a review from jrmccannon August 13, 2026 15:49
@JaredScar JaredScar added the t:bugfix Change Type - Bugfix label Aug 13, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR parallelizes the two independent data fetches in OrganizationsController.GetUser() using Task.WhenAll. Both calls bottom out in repositories that isolate their own data access per invocation — the EF implementations (OrganizationUserRepository.GetManyDetailsByUserAsync, OrganizationRepository.GetByVerifiedUserEmailDomainAsync) each create a fresh IServiceScope/DatabaseContext, and the Dapper implementations each open a new SqlConnection — so concurrent execution does not share a non-thread-safe DbContext. The Task.WhenAll followed by re-awaiting each task matches existing usage in OrganizationExportController and CountsController, and neither task touches HttpContext/ClaimsPrincipal (the userId is resolved before the fan-out). Response payload and exception semantics are unchanged.

Code Review Details

No findings.

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.17%. Comparing base (643e3aa) to head (f16b50b).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...dminConsole/Controllers/OrganizationsController.cs 0.00% 5 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (643e3aa) and HEAD (f16b50b). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (643e3aa) HEAD (f16b50b)
2 1
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8202      +/-   ##
==========================================
- Coverage   68.41%   63.17%   -5.24%     
==========================================
  Files        2380     2381       +1     
  Lines      103679   103774      +95     
  Branches     9386     9394       +8     
==========================================
- Hits        70931    65560    -5371     
- Misses      30420    35983    +5563     
+ Partials     2328     2231      -97     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@JaredScar JaredScar added t:tech-debt Change Type - Tech debt and removed t:bugfix Change Type - Bugfix labels Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:tech-debt Change Type - Tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant