Avoid repeated reloads of content and media cache following Deploy operations. #10360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is an attempt to mitigate some issues reported on Umbraco Cloud with deployment operations containing document type changes and large databases (either numbers of nodes, versions or both).
I've observed from logs that there are repeated calls to reload the content and media cache - twice for every document type in the deployment batch - so with 5 document types, there are 10 full reloads.
This seems unnecessary - as when a document type changes all content is reloaded. There's no logic to refresh parts of the cache for different document types, hence it seems we don't really care which document type has been updated in this context, just that one has.
So I've amended the logic for refreshing the cache to handle only single content type event, even if there are several.
I initially tried to adapt this in Deploy - by only raising one event instead of several - but there are other components, namely Heartcore, that rely on knowing exactly which content type has changed via the distributed cache.
To Test: