Repository navigation
fix: clear instance pools after adding media - #6740
Merged
Merged
Conversation
Since null results are cached in the instance pool, rex_mediapool::filename() leaves a cached null for the chosen filename, so rex_media::get() returned null for the newly added media for the rest of the request (e.g. in MEDIA_ADDED). - clear the rex_media instance of the new file in rex_media_service::addMedia() - clear the root media list of rex_media when media lists are deleted - clear the mediapool instance pools on CACHE_DELETED - let rex_user::clearInstance() also remove cached null entries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Since #6674 null results are cached in the instance pool.
rex_mediapool::filename()callsrex_media::get()for the candidate names and stops at the first one that returns null — so the chosen filename ends up with a cached null.rex_media_service::addMedia()didn't clear that instance, so for the rest of the requestrex_media::get()returned null for the newly added media (e.g. inMEDIA_ADDEDlisteners, during the sync page loop, or evendeleteMedia()in the same request).Changes:
rex_mediainstance of the new file inrex_media_service::addMedia()root_medialist ofrex_mediainrex_media_cache::deleteList(0)/deleteLists()(only therex_media_categorylists were cleared, sorex_media::getRootMedia()stayed stale)CACHE_DELETED(like the structure addon does)rex_user::clearInstance()returned early for cached null entries, so they could never be cleared; it now removes the given key in that case