From ef1550f578c562276b4f0cef5aa05e119db2d6ef Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Wed, 1 Jan 2025 16:10:52 +1300 Subject: [PATCH] no point using redis caching when the relationship is joined anyway --- app/activitypub/util.py | 3 --- app/models.py | 3 --- app/user/routes.py | 6 ------ 3 files changed, 12 deletions(-) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index bdb24f65..43e812af 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -555,11 +555,8 @@ def refresh_user_profile_task(user_id): session.commit() if user.avatar_id and avatar_changed: make_image_sizes(user.avatar_id, 40, 250, 'users') - cache.delete_memoized(User.avatar_image, user) - cache.delete_memoized(User.avatar_thumbnail, user) if user.cover_id and cover_changed: make_image_sizes(user.cover_id, 700, 1600, 'users') - cache.delete_memoized(User.cover_image, user) session.close() diff --git a/app/models.py b/app/models.py index 1049b542..e9413237 100644 --- a/app/models.py +++ b/app/models.py @@ -770,7 +770,6 @@ class User(UserMixin, db.Model): else: return '[deleted]' - @cache.memoize(timeout=500) def avatar_thumbnail(self) -> str: if self.avatar_id is not None: if self.avatar.thumbnail_path is not None: @@ -782,7 +781,6 @@ class User(UserMixin, db.Model): return self.avatar_image() return '' - @cache.memoize(timeout=500) def avatar_image(self) -> str: if self.avatar_id is not None: if self.avatar.file_path is not None: @@ -797,7 +795,6 @@ class User(UserMixin, db.Model): return self.avatar.source_url return '' - @cache.memoize(timeout=500) def cover_image(self) -> str: if self.cover_id is not None: if self.cover.thumbnail_path is not None: diff --git a/app/user/routes.py b/app/user/routes.py index bae7f1c4..1749649b 100644 --- a/app/user/routes.py +++ b/app/user/routes.py @@ -153,8 +153,6 @@ def edit_profile(actor): file = save_icon_file(profile_file, 'users') if file: current_user.avatar = file - cache.delete_memoized(User.avatar_image, current_user) - cache.delete_memoized(User.avatar_thumbnail, current_user) banner_file = request.files['banner_file'] if banner_file and banner_file.filename != '': # remove old cover @@ -168,7 +166,6 @@ def edit_profile(actor): file = save_banner_file(banner_file, 'users') if file: current_user.cover = file - cache.delete_memoized(User.cover_image, current_user) db.session.commit() @@ -207,8 +204,6 @@ def remove_avatar(): current_user.avatar_id = None db.session.delete(file) db.session.commit() - cache.delete_memoized(User.avatar_image, current_user) - cache.delete_memoized(User.avatar_thumbnail, current_user) return _('Avatar removed!') @@ -223,7 +218,6 @@ def remove_cover(): current_user.cover_id = None db.session.delete(file) db.session.commit() - cache.delete_memoized(User.cover_image, current_user) return '