Performance: Added request cache to media type retrieval in media picker validation#20405
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds request-level caching to media type retrieval in the MediaPicker3 validation to improve performance when validating multiple media items across languages and blocks. The caching prevents redundant database queries for the same media type during a single request.
Key Changes
- Added AppCaches dependency to MediaPicker3PropertyValueEditor and AllowedTypeValidator
- Implemented request cache for media type lookups using media type keys instead of full objects
- Updated unit tests to include the new AppCaches parameter
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Umbraco.Infrastructure/PropertyEditors/MediaPicker3PropertyEditor.cs | Added AppCaches parameter and implemented request caching for media type lookups in validation |
| tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/MediaPicker3ValueEditorValidationTests.cs | Updated test constructor to include AppCaches.Disabled parameter |
| tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/DataValueReferenceFactoryCollectionTests.cs | Updated test constructor to include AppCaches.Disabled parameter |
src/Umbraco.Infrastructure/PropertyEditors/MediaPicker3PropertyEditor.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Infrastructure/PropertyEditors/MediaPicker3PropertyEditor.cs
Outdated
Show resolved
Hide resolved
Migaroez
left a comment
There was a problem hiding this comment.
It works, and I agree that we need this bandaid.
But we really need to look into how to deal with determning all the requirements (datatypes/elementypes/...) to process (validate/update/clean/...) these types of nested content. This is the second "caching" mechanism on top of our repository caches that gets introduced now (see BlockEditorElementTypeCache).
…ker validation (#20405) * Added request cache to media type retrieval in media picker validation. * Applied suggestions from code review.
|
This pull request has been mentioned on Umbraco community forum. There might be relevant details there: https://forum.umbraco.com/t/website-significantly-slower-since-upgrading-from-v13-to-v16/6049/18 |
Updated [Umbraco.Cms.Persistence.Sqlite](https://github.com/umbraco/Umbraco-CMS) from 16.2.0 to 16.3.4. <details> <summary>Release notes</summary> _Sourced from [Umbraco.Cms.Persistence.Sqlite's releases](https://github.com/umbraco/Umbraco-CMS/releases)._ ## 16.3.4 ## What's Changed ### 🐛 Bug Fixes * Content picker: Implement a specific sorting method for statuses (closes #20646) by @nielslyngsoe in umbraco/Umbraco-CMS#20609 * Caching: Resolves publish and install issues related to stale cached data retrieval (closes #20539 and #20630) by @AndyButland in umbraco/Umbraco-CMS#20640 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.3...release-16.3.4 ## 16.3.3 ## What's Changed ### 🐛 Bug Fixes * Migrations: Use reliable GUID to check for existence of data type when creating (closes #20592) by @AndyButland in umbraco/Umbraco-CMS#20604 * Trees: Restore backward compatibility for file system based tree controllers (closes #20602) by @AndyButland in umbraco/Umbraco-CMS#20608 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.2...release-16.3.3 ## 16.3.2 ## What's Changed ### 🐛 Bug Fixes * Hybrid Cache: Resolve start-up errors with mis-matched types (closes #20537) by @AndyButland in umbraco/Umbraco-CMS#20554 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.1...release-16.3.2 ## 16.3.1 ## What's Changed ### 🐛 Bug Fixes * Fixed regression caused by incorrect handling of breaking change on block editor base constructor by @BenWhite27 in umbraco/Umbraco-CMS#20532 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.0...release-16.3.1 ## 16.3.0 ## What's Changed ### 🙌 Notable Changes * Feature: Client Cache for Document Type and Data Type Detail Models by @madsrasmussen in umbraco/Umbraco-CMS#19904 * Feature: Client Cache for Document Item Models by @madsrasmussen in umbraco/Umbraco-CMS#19923 * Feature: Add client runtime cache for all item endpoints by @madsrasmussen in umbraco/Umbraco-CMS#19960 * Tiptap RTE: Unbundled "Rich Text Essentials" - Toggle basics on/off per data type by @leekelleher in umbraco/Umbraco-CMS#20042 ### 🏠 Internal * build(deps-dev): bump vite from v6 to v7 by @iOvergaard in umbraco/Umbraco-CMS#19974 ### 📦 Dependencies * Chore: upgrade typescript to 5.9 + other minors by @nielslyngsoe in umbraco/Umbraco-CMS#19914 * Bump vite-plugin-static-copy from 3.1.1 to 3.1.2 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#19969 * Bump @hey-api/openapi-ts to 0.81.1 by @iOvergaard in umbraco/Umbraco-CMS#19982 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#20114 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Login by @dependabot[bot] in umbraco/Umbraco-CMS#20181 * Dependencies: Update ImageSharp to latest patch releases (16) by @AndyButland in umbraco/Umbraco-CMS#20276 ### 🌈 Accessibility Improvements * Navigating the App Language Selector with the keyboard by @engijlr in umbraco/Umbraco-CMS#19887 * Profile: Corrected misleading button label by @OskarKruger in umbraco/Umbraco-CMS#20161 * Tiptap RTE: Adds accessibility attributes for RTE input by @OskarKruger in umbraco/Umbraco-CMS#20157 * Workspace Actions: set attributes on the right element for label to work by @nielslyngsoe in umbraco/Umbraco-CMS#20178 * Tags Property Editor: Remove tags with keyboard backspace/delete by @engijlr in umbraco/Umbraco-CMS#19892 * Accessibility changes for the top navbar tabs and settings tabs by @Abdjulaziz in umbraco/Umbraco-CMS#20107 * Update label for tree item caret to identify if open or closed by @OskarKruger in umbraco/Umbraco-CMS#20199 * Tiptap RTE: Adds hover and focus border input states by @OskarKruger in umbraco/Umbraco-CMS#20172 * Installer: Improves user accessibility by adding missing <form> elements and setting the right focus by @iOvergaard in umbraco/Umbraco-CMS#20265 * Allow open split view using the keyboard by @engijlr in umbraco/Umbraco-CMS#19927 ### 🚀 New Features * Update dotnet new umbraco-extension template with newer @hey-api/openapi-ts by @warrenbuckley in umbraco/Umbraco-CMS#19825 * Workspace view navigation context by @nielslyngsoe in umbraco/Umbraco-CMS#19255 * Add timestamps to cache entries and server events by @madsrasmussen in umbraco/Umbraco-CMS#19976 * Block workspace view validation badges by @nielslyngsoe in umbraco/Umbraco-CMS#19987 * Section Sidebar Menu Expansion by @madsrasmussen in umbraco/Umbraco-CMS#19810 * Structure manager refactor implementation by @nielslyngsoe in umbraco/Umbraco-CMS#19970 * Moves icon dependencies to 'core' package.json by @iOvergaard in umbraco/Umbraco-CMS#20041 * Tiptap RTE: Migration to auto-enable new capabilities by @leekelleher in umbraco/Umbraco-CMS#20057 * Database creation/migration for UFM Label editor data-types by @leekelleher in umbraco/Umbraco-CMS#20055 * Workspace View Manifest Overrides by @nielslyngsoe in umbraco/Umbraco-CMS#20033 * Property Editors: Add Missing Property Editor fallback by @lauraneto in umbraco/Umbraco-CMS#19997 * Variants: Implements validation hints to the variant selector (closes #19953) by @iOvergaard in umbraco/Umbraco-CMS#20179 * Interaction Memory: Feature for picker modal state retention (#18305) by @madsrasmussen in umbraco/Umbraco-CMS#20159 * View Context: Implement browser title by @nielslyngsoe in umbraco/Umbraco-CMS#20145 * Icons: Add more heading icons by @bjarnef in umbraco/Umbraco-CMS#20242 * Tiptap RTE: Adds heading (h4-h6) toolbar buttons by @bjarnef in umbraco/Umbraco-CMS#20243 * Introduced sign providers for trees and implemented one for documents with schedule pending by @AndyButland in umbraco/Umbraco-CMS#19806 * Feature: Inflight Request Cache for Document Types and Data Types by @madsrasmussen in umbraco/Umbraco-CMS#19956 * Feature: Redirect to the last visited path when navigating between sections by @madsrasmussen in umbraco/Umbraco-CMS#20084 * Introducing signs to variants by @NillasKA in umbraco/Umbraco-CMS#20053 * Add Vietnamese to UI culture by @NguyenThuyLan in umbraco/Umbraco-CMS#20061 ### 🐛 Bug Fixes * Fixed behaviour on database cache rebuild to update only for requested content types by @AndyButland in umbraco/Umbraco-CMS#19905 ... (truncated) ## 16.3.0-rc4 ## What's Changed in 16.3.0-rc4 ### 🚤 Performance * Performance: Added request cache to media type retrieval in media picker validation, resolving performance regression in validate and save by @AndyButland in umbraco/Umbraco-CMS#20405 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.0-rc3...release-16.3.0-rc4 ## What's Changed in 16.3.0-rc3 ### 🐛 Bug Fixes * Hybrid cache: Check for `ContentCacheNode` instead of object on exists for hybrid cache to ensure correct deserialization (closes #20352) by @AndyButland in umbraco/Umbraco-CMS#20383 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.0-rc2...release-16.3.0-rc3 ## What's Changed in 16.3.0-rc2 ### 🐛 Bug Fixes * Caching: Fixes regression of the caching of null representations for missing dictionary items (closes #20336) by @AndyButland in umbraco/Umbraco-CMS#20349 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.0-rc...release-16.3.0-rc2 ## What's Changed Since The Last Release (16.2.0) ### 🙌 Notable Changes - Testing encouraged and appreciated! * Feature: Client Cache for Document Type and Data Type Detail Models by @madsrasmussen in umbraco/Umbraco-CMS#19904 * Feature: Client Cache for Document Item Models by @madsrasmussen in umbraco/Umbraco-CMS#19923 * Feature: Add client runtime cache for all item endpoints by @madsrasmussen in umbraco/Umbraco-CMS#19960 * Tiptap RTE: Unbundled "Rich Text Essentials" - Toggle basics on/off per data type by @leekelleher in umbraco/Umbraco-CMS#20042 ### 🏠 Internal * build(deps-dev): bump vite from v6 to v7 by @iOvergaard in umbraco/Umbraco-CMS#19974 ### 📦 Dependencies * Chore: upgrade typescript to 5.9 + other minors by @nielslyngsoe in umbraco/Umbraco-CMS#19914 * Bump vite-plugin-static-copy from 3.1.1 to 3.1.2 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#19969 * Bump @hey-api/openapi-ts to 0.81.1 by @iOvergaard in umbraco/Umbraco-CMS#19982 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#20114 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Login by @dependabot[bot] in umbraco/Umbraco-CMS#20181 * Dependencies: Update ImageSharp to latest patch releases (16) by @AndyButland in umbraco/Umbraco-CMS#20276 ### 🌈 Accessibility Improvements * Navigating the App Language Selector with the keyboard by @engijlr in umbraco/Umbraco-CMS#19887 * Profile: Corrected misleading button label by @OskarKruger in umbraco/Umbraco-CMS#20161 * Tiptap RTE: Adds accessibility attributes for RTE input by @OskarKruger in umbraco/Umbraco-CMS#20157 * Workspace Actions: set attributes on the right element for label to work by @nielslyngsoe in umbraco/Umbraco-CMS#20178 * Tags Property Editor: Remove tags with keyboard backspace/delete by @engijlr in umbraco/Umbraco-CMS#19892 * Accessibility changes for the top navbar tabs and settings tabs by @Abdjulaziz in umbraco/Umbraco-CMS#20107 * Update label for tree item caret to identify if open or closed by @OskarKruger in umbraco/Umbraco-CMS#20199 * Tiptap RTE: Adds hover and focus border input states by @OskarKruger in umbraco/Umbraco-CMS#20172 * Installer: Improves user accessibility by adding missing <form> elements and setting the right focus by @iOvergaard in umbraco/Umbraco-CMS#20265 ... (truncated) ## 16.3.0-rc3 ## What's Changed in 16.3.0-rc3 ### 🐛 Bug Fixes * Hybrid cache: Check for `ContentCacheNode` instead of object on exists for hybrid cache to ensure correct deserialization (closes #20352) by @AndyButland in umbraco/Umbraco-CMS#20383 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.0-rc2...release-16.3.0-rc3 ## What's Changed in 16.3.0-rc2 ### 🐛 Bug Fixes * Caching: Fixes regression of the caching of null representations for missing dictionary items (closes #20336) by @AndyButland in umbraco/Umbraco-CMS#20349 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.0-rc...release-16.3.0-rc2 ## What's Changed Since The Last Release (16.2.0) ### 🙌 Notable Changes - Testing encouraged and appreciated! * Feature: Client Cache for Document Type and Data Type Detail Models by @madsrasmussen in umbraco/Umbraco-CMS#19904 * Feature: Client Cache for Document Item Models by @madsrasmussen in umbraco/Umbraco-CMS#19923 * Feature: Add client runtime cache for all item endpoints by @madsrasmussen in umbraco/Umbraco-CMS#19960 * Tiptap RTE: Unbundled "Rich Text Essentials" - Toggle basics on/off per data type by @leekelleher in umbraco/Umbraco-CMS#20042 ### 🏠 Internal * build(deps-dev): bump vite from v6 to v7 by @iOvergaard in umbraco/Umbraco-CMS#19974 ### 📦 Dependencies * Chore: upgrade typescript to 5.9 + other minors by @nielslyngsoe in umbraco/Umbraco-CMS#19914 * Bump vite-plugin-static-copy from 3.1.1 to 3.1.2 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#19969 * Bump @hey-api/openapi-ts to 0.81.1 by @iOvergaard in umbraco/Umbraco-CMS#19982 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#20114 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Login by @dependabot[bot] in umbraco/Umbraco-CMS#20181 * Dependencies: Update ImageSharp to latest patch releases (16) by @AndyButland in umbraco/Umbraco-CMS#20276 ### 🌈 Accessibility Improvements * Navigating the App Language Selector with the keyboard by @engijlr in umbraco/Umbraco-CMS#19887 * Profile: Corrected misleading button label by @OskarKruger in umbraco/Umbraco-CMS#20161 * Tiptap RTE: Adds accessibility attributes for RTE input by @OskarKruger in umbraco/Umbraco-CMS#20157 * Workspace Actions: set attributes on the right element for label to work by @nielslyngsoe in umbraco/Umbraco-CMS#20178 * Tags Property Editor: Remove tags with keyboard backspace/delete by @engijlr in umbraco/Umbraco-CMS#19892 * Accessibility changes for the top navbar tabs and settings tabs by @Abdjulaziz in umbraco/Umbraco-CMS#20107 * Update label for tree item caret to identify if open or closed by @OskarKruger in umbraco/Umbraco-CMS#20199 * Tiptap RTE: Adds hover and focus border input states by @OskarKruger in umbraco/Umbraco-CMS#20172 * Installer: Improves user accessibility by adding missing <form> elements and setting the right focus by @iOvergaard in umbraco/Umbraco-CMS#20265 * Allow open split view using the keyboard by @engijlr in umbraco/Umbraco-CMS#19927 ### 🚀 New Features * Update dotnet new umbraco-extension template with newer @hey-api/openapi-ts by @warrenbuckley in umbraco/Umbraco-CMS#19825 * Workspace view navigation context by @nielslyngsoe in umbraco/Umbraco-CMS#19255 * Add timestamps to cache entries and server events by @madsrasmussen in umbraco/Umbraco-CMS#19976 * Block workspace view validation badges by @nielslyngsoe in umbraco/Umbraco-CMS#19987 * Section Sidebar Menu Expansion by @madsrasmussen in umbraco/Umbraco-CMS#19810 * Structure manager refactor implementation by @nielslyngsoe in umbraco/Umbraco-CMS#19970 ... (truncated) ## 16.3.0-rc2 ## What's Changed in 16.3.0-rc2 ### 🐛 Bug Fixes * Caching: Fixes regression of the caching of null representations for missing dictionary items (closes #20336) by @AndyButland in umbraco/Umbraco-CMS#20349 **Full Changelog**: umbraco/Umbraco-CMS@release-16.3.0-rc...release-16.3.0-rc2 ## What's Changed Since The Last Release (16.2.0) ### 🙌 Notable Changes - Testing encouraged and appreciated! * Feature: Client Cache for Document Type and Data Type Detail Models by @madsrasmussen in umbraco/Umbraco-CMS#19904 * Feature: Client Cache for Document Item Models by @madsrasmussen in umbraco/Umbraco-CMS#19923 * Feature: Add client runtime cache for all item endpoints by @madsrasmussen in umbraco/Umbraco-CMS#19960 * Tiptap RTE: Unbundled "Rich Text Essentials" - Toggle basics on/off per data type by @leekelleher in umbraco/Umbraco-CMS#20042 ### 🏠 Internal * build(deps-dev): bump vite from v6 to v7 by @iOvergaard in umbraco/Umbraco-CMS#19974 ### 📦 Dependencies * Chore: upgrade typescript to 5.9 + other minors by @nielslyngsoe in umbraco/Umbraco-CMS#19914 * Bump vite-plugin-static-copy from 3.1.1 to 3.1.2 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#19969 * Bump @hey-api/openapi-ts to 0.81.1 by @iOvergaard in umbraco/Umbraco-CMS#19982 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#20114 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Login by @dependabot[bot] in umbraco/Umbraco-CMS#20181 * Dependencies: Update ImageSharp to latest patch releases (16) by @AndyButland in umbraco/Umbraco-CMS#20276 ### 🌈 Accessibility Improvements * Navigating the App Language Selector with the keyboard by @engijlr in umbraco/Umbraco-CMS#19887 * Profile: Corrected misleading button label by @OskarKruger in umbraco/Umbraco-CMS#20161 * Tiptap RTE: Adds accessibility attributes for RTE input by @OskarKruger in umbraco/Umbraco-CMS#20157 * Workspace Actions: set attributes on the right element for label to work by @nielslyngsoe in umbraco/Umbraco-CMS#20178 * Tags Property Editor: Remove tags with keyboard backspace/delete by @engijlr in umbraco/Umbraco-CMS#19892 * Accessibility changes for the top navbar tabs and settings tabs by @Abdjulaziz in umbraco/Umbraco-CMS#20107 * Update label for tree item caret to identify if open or closed by @OskarKruger in umbraco/Umbraco-CMS#20199 * Tiptap RTE: Adds hover and focus border input states by @OskarKruger in umbraco/Umbraco-CMS#20172 * Installer: Improves user accessibility by adding missing <form> elements and setting the right focus by @iOvergaard in umbraco/Umbraco-CMS#20265 * Allow open split view using the keyboard by @engijlr in umbraco/Umbraco-CMS#19927 ### 🚀 New Features * Update dotnet new umbraco-extension template with newer @hey-api/openapi-ts by @warrenbuckley in umbraco/Umbraco-CMS#19825 * Workspace view navigation context by @nielslyngsoe in umbraco/Umbraco-CMS#19255 * Add timestamps to cache entries and server events by @madsrasmussen in umbraco/Umbraco-CMS#19976 * Block workspace view validation badges by @nielslyngsoe in umbraco/Umbraco-CMS#19987 * Section Sidebar Menu Expansion by @madsrasmussen in umbraco/Umbraco-CMS#19810 * Structure manager refactor implementation by @nielslyngsoe in umbraco/Umbraco-CMS#19970 * Moves icon dependencies to 'core' package.json by @iOvergaard in umbraco/Umbraco-CMS#20041 * Tiptap RTE: Migration to auto-enable new capabilities by @leekelleher in umbraco/Umbraco-CMS#20057 * Database creation/migration for UFM Label editor data-types by @leekelleher in umbraco/Umbraco-CMS#20055 * Workspace View Manifest Overrides by @nielslyngsoe in umbraco/Umbraco-CMS#20033 * Property Editors: Add Missing Property Editor fallback by @lauraneto in umbraco/Umbraco-CMS#19997 * Variants: Implements validation hints to the variant selector (closes #19953) by @iOvergaard in umbraco/Umbraco-CMS#20179 * Interaction Memory: Feature for picker modal state retention (#18305) by @madsrasmussen in umbraco/Umbraco-CMS#20159 * View Context: Implement browser title by @nielslyngsoe in umbraco/Umbraco-CMS#20145 ... (truncated) ## 16.3.0-rc <!-- Release notes generated using configuration in .github/release.yml at release-16.3.0-rc --> ## What's Changed ### 🙌 Notable Changes - Testing encouraged and appreciated! * Feature: Client Cache for Document Type and Data Type Detail Models by @madsrasmussen in umbraco/Umbraco-CMS#19904 * Feature: Client Cache for Document Item Models by @madsrasmussen in umbraco/Umbraco-CMS#19923 * Feature: Add client runtime cache for all item endpoints by @madsrasmussen in umbraco/Umbraco-CMS#19960 * Tiptap RTE: Unbundled "Rich Text Essentials" - Toggle basics on/off per data type by @leekelleher in umbraco/Umbraco-CMS#20042 ### 🏠 Internal * build(deps-dev): bump vite from v6 to v7 by @iOvergaard in umbraco/Umbraco-CMS#19974 ### 📦 Dependencies * Chore: upgrade typescript to 5.9 + other minors by @nielslyngsoe in umbraco/Umbraco-CMS#19914 * Bump vite-plugin-static-copy from 3.1.1 to 3.1.2 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#19969 * Bump @hey-api/openapi-ts to 0.81.1 by @iOvergaard in umbraco/Umbraco-CMS#19982 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Client by @dependabot[bot] in umbraco/Umbraco-CMS#20114 * Bump vite from 7.1.3 to 7.1.5 in /src/Umbraco.Web.UI.Login by @dependabot[bot] in umbraco/Umbraco-CMS#20181 * Dependencies: Update ImageSharp to latest patch releases (16) by @AndyButland in umbraco/Umbraco-CMS#20276 ### 🌈 Accessibility Improvements * Navigating the App Language Selector with the keyboard by @engijlr in umbraco/Umbraco-CMS#19887 * Profile: Corrected misleading button label by @OskarKruger in umbraco/Umbraco-CMS#20161 * Tiptap RTE: Adds accessibility attributes for RTE input by @OskarKruger in umbraco/Umbraco-CMS#20157 * Workspace Actions: set attributes on the right element for label to work by @nielslyngsoe in umbraco/Umbraco-CMS#20178 * Tags Property Editor: Remove tags with keyboard backspace/delete by @engijlr in umbraco/Umbraco-CMS#19892 * Accessibility changes for the top navbar tabs and settings tabs by @Abdjulaziz in umbraco/Umbraco-CMS#20107 * Update label for tree item caret to identify if open or closed by @OskarKruger in umbraco/Umbraco-CMS#20199 * Tiptap RTE: Adds hover and focus border input states by @OskarKruger in umbraco/Umbraco-CMS#20172 * Installer: Improves user accessibility by adding missing <form> elements and setting the right focus by @iOvergaard in umbraco/Umbraco-CMS#20265 * Allow open split view using the keyboard by @engijlr in umbraco/Umbraco-CMS#19927 ### 🚀 New Features * Update dotnet new umbraco-extension template with newer @hey-api/openapi-ts by @warrenbuckley in umbraco/Umbraco-CMS#19825 * Workspace view navigation context by @nielslyngsoe in umbraco/Umbraco-CMS#19255 * Add timestamps to cache entries and server events by @madsrasmussen in umbraco/Umbraco-CMS#19976 * Block workspace view validation badges by @nielslyngsoe in umbraco/Umbraco-CMS#19987 * Section Sidebar Menu Expansion by @madsrasmussen in umbraco/Umbraco-CMS#19810 * Structure manager refactor implementation by @nielslyngsoe in umbraco/Umbraco-CMS#19970 * Moves icon dependencies to 'core' package.json by @iOvergaard in umbraco/Umbraco-CMS#20041 * Tiptap RTE: Migration to auto-enable new capabilities by @leekelleher in umbraco/Umbraco-CMS#20057 * Database creation/migration for UFM Label editor data-types by @leekelleher in umbraco/Umbraco-CMS#20055 * Workspace View Manifest Overrides by @nielslyngsoe in umbraco/Umbraco-CMS#20033 * Property Editors: Add Missing Property Editor fallback by @lauraneto in umbraco/Umbraco-CMS#19997 * Variants: Implements validation hints to the variant selector (closes #19953) by @iOvergaard in umbraco/Umbraco-CMS#20179 * Interaction Memory: Feature for picker modal state retention (#18305) by @madsrasmussen in umbraco/Umbraco-CMS#20159 * View Context: Implement browser title by @nielslyngsoe in umbraco/Umbraco-CMS#20145 * Icons: Add more heading icons by @bjarnef in umbraco/Umbraco-CMS#20242 * Tiptap RTE: Adds heading (h4-h6) toolbar buttons by @bjarnef in umbraco/Umbraco-CMS#20243 * Introduced sign providers for trees and implemented one for documents with schedule pending by @AndyButland in umbraco/Umbraco-CMS#19806 * Feature: Inflight Request Cache for Document Types and Data Types by @madsrasmussen in umbraco/Umbraco-CMS#19956 * Feature: Redirect to the last visited path when navigating between sections by @madsrasmussen in umbraco/Umbraco-CMS#20084 * Introducing signs to variants by @NillasKA in umbraco/Umbraco-CMS#20053 * Add Vietnamese to UI culture by @NguyenThuyLan in umbraco/Umbraco-CMS#20061 ... (truncated) Commits viewable in [compare view](umbraco/Umbraco-CMS@release-16.2.0...release-16.3.4). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) You can trigger a rebase of this PR by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> > **Note** > Automatic rebases have been disabled on this pull request as it has been open for over 30 days. Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Prerequisites
From internal support issue.
Description
#18429 introduced server-side validation for the media picker, including validating that the types of the media provided are permitted via the configured allowed types.
In here there's a call to retrieve the media type from it's alias.
This in itself is cached at the repository, but there's a read lock placed each time and that requires a tiny database query. When you multiply languages x blocks x media properties - this can be a lot of calls. Running locally this is negligible, but running locally with a database in Azure, on the test site I've been working with, it's many times slower. Running a website and a database in Azure won't be quite that bad, but they are still running on different machines so seems this latency for even this small query multiple times can be a problem.
I found it just by turning all read locks off and finding much more acceptable performance, and then looked to where they were all coming from, and found them in the media picker validation.
To resolve I've added a request cache so we only retrieve each media type once at most, no matter how many blocks/languages/properties there are.
Testing
See test steps on #18429 for verifying that the server-side validation still works as it should.
Adding
_logger.LogInformation("Requesting read lock(s) {LockIds} for scope {InstanceId}", string.Join(", ", lockIds), instanceId);toLockingMechanism.EagerReadLockInner()will allow you see read locks as they are created and verify that only one should be called for each allowed media type.