-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
url_preview media cache is not expired when background database migrations are running #13637
Description
Normally, any media downloaded as part of a url preview is deleted after a day. However, while a background database migration is running, the process is stopped. If there is a long-running database migration, this can therefore cause the media store to fill up with old preview files.
This logic was added in #2697 to make sure that we didn't try to run the expiry without an index on local_media_repository.created_ts
; the original logic that needs that index was added in #2478 (in get_url_cache_media_before
, as amended by 93247a4), and is still present.
It looks like too broad a constraint: instead, we should use has_completed_background_update
to check if the specific background update we care about has completed. However, given you'd have to be upgrading from before Synapse v1.0.0 (which created the v54
schema snapshot) to not have this index in place... we should probably just drop the check altogether.