This is a submission for DEV's Summer Bug Smash: Clear the Lineup powered by Sentry.
Project Overview
OrchardCore is an open-source, modular, multi-tenant application framework and CMS built on ASP.NET Core. In a multi-tenant deployment, the Tenants admin page is where administrators manage every tenant on the instance, searching, filtering by category or status, and paging through the list.
Bug Fix or Performance Improvement
Issue #19556 reported that the tenants admin list got noticeably slow to load as the tenant count grew. The root cause was in AdminController.Index: the pipeline was projecting every tenant into a ShellSettingsEntry, which involves reading each tenant's Category/Description config and generating a protection token via dataProtector.Protect, before filtering, sorting, and paging were applied. That meant those relatively expensive per-tenant reads ran once for every tenant in the system, even though only aprox 10 rows are ever rendered on a single page.
Code
PR: https://github.com/OrchardCMS/OrchardCore/pull/19557
Closes #19556
My Improvements
The fix reorders the pipeline so cheap operations happen first, and expensive ones happen last:
- *Filter first *- apply search, category, and status filters against lightweight
ShellSettingsdata, not the fully projected view model. The category filter only readssettings["Category"]when a category filter is actually active. - Sort next-order the filtered, still-cheap result set.
- Page-slice down to just the current page's rows.
-
Project last-only now build the full
ShellSettingsEntry(config reads + token generation) for the handful of tenants that will actually be displayed.
One regression surfaced during review: an early version of the reorder accidentally applied a blanket .OrderBy that changed the Category dropdown's ordering. That was fixed by scoping the .OrderBy specifically to the dropdown's GroupBy, preserving the original alphabetical order without reintroducing the sort across the whole list. A regression test for tenant admin paging was added before merge.
Two related fixes-caching for the category dropdown, and per-tenant semaphore/async warmup in `ShellSettingsManager '- were identified but deliberately left out of scope for this PR to keep the change focused and reviewable.
Merged by sebastienros into OrchardCMS: main, milestone 4.x, flagged as a possible backport candidate.
Top comments (0)