diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2017-11-27 12:25:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-27 12:25:48 +0000 |
commit | 5a4da5bf784669e0b0263279b7a0b0804026348f (patch) | |
tree | d8d9d2597243e1304bee0fe6e80e4c5aaf0710a0 /synapse/rest/media/v1/preview_url_resource.py | |
parent | Merge pull request #2713 from matrix-org/rav/no_upsert_forever (diff) | |
parent | fix sql fails (diff) | |
download | synapse-5a4da5bf784669e0b0263279b7a0b0804026348f.tar.xz |
Merge pull request #2697 from matrix-org/rav/fix_urlcache_index_error
Fix error on sqlite 3.7
Diffstat (limited to 'synapse/rest/media/v1/preview_url_resource.py')
-rw-r--r-- | synapse/rest/media/v1/preview_url_resource.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py index 65f86be205..40d2e664eb 100644 --- a/synapse/rest/media/v1/preview_url_resource.py +++ b/synapse/rest/media/v1/preview_url_resource.py @@ -352,11 +352,16 @@ class PreviewUrlResource(Resource): def _expire_url_cache_data(self): """Clean up expired url cache content, media and thumbnails. """ - # TODO: Delete from backup media store now = self.clock.time_msec() + logger.info("Running url preview cache expiry") + + if not (yield self.store.has_completed_background_updates()): + logger.info("Still running DB updates; skipping expiry") + return + # First we delete expired url cache entries media_ids = yield self.store.get_expired_url_cache(now) @@ -430,8 +435,7 @@ class PreviewUrlResource(Resource): yield self.store.delete_url_cache_media(removed_media) - if removed_media: - logger.info("Deleted %d media from url cache", len(removed_media)) + logger.info("Deleted %d media from url cache", len(removed_media)) def decode_and_calc_og(body, media_uri, request_encoding=None): |