From f7cfaa184e2ab9a0ae8734987e5a3ee7486cf809 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 31 Aug 2021 18:32:04 +0200 Subject: [PATCH] fdfd --- files/classes/user.py | 8 ++++---- files/routes/front.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 73bbe0374..97b8a358b 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -160,7 +160,7 @@ class User(Base, Stndrd, Age_times): def strid(self): return str(self.id) - @cache.memoize() + @cache.memoize(timeout=86400) def userpagelisting(self, v=None, page=1, sort="new", t="all"): submissions = g.db.query(Submission).options(lazyload('*')).filter_by(author_id=self.id, is_pinned=False) @@ -202,7 +202,7 @@ class User(Base, Stndrd, Age_times): listing = [x.id for x in submissions[firstrange:secondrange]] return listing - @cache.memoize() + @cache.memoize(timeout=86400) def commentlisting(self, v=None, page=1, sort="new", t="all"): comments = self.comments.options(lazyload('*')).filter(Comment.parent_submission != None).join(Comment.post) @@ -350,7 +350,7 @@ class User(Base, Stndrd, Age_times): return self.notifications.filter(Notification.read == False).join(Notification.comment).filter( Comment.author_id == AUTOJANNY_ACCOUNT).count() - @cache.memoize() + @cache.memoize(timeout=86400) def notification_messages(self, page=1): if self.admin_level == 6: comments = g.db.query(Comment).filter(or_(Comment.author_id==self.id, Comment.sentto==self.id, Comment.sentto==0)).filter(Comment.parent_submission == None).order_by(Comment.created_utc.desc()).limit(100).all() @@ -488,7 +488,7 @@ class User(Base, Stndrd, Age_times): if self.bannerurl: return self.bannerurl else: return f"https://{site}/assets/images/default_bg.gif" - @cache.memoize() + @cache.memoize(timeout=86400) def defaultpicture(self): pic = random.randint(1, 150) return f"https://{site}/assets/images/defaultpictures/{pic}.gif" diff --git a/files/routes/front.py b/files/routes/front.py index 4e84955dd..36a393c9c 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -72,7 +72,7 @@ def notifications(v): render_replies=True, is_notification_page=True) -@cache.memoize() +@cache.memoize(timeout=86400) def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', **kwargs): posts = g.db.query(Submission).options(lazyload('*')) @@ -226,7 +226,7 @@ def front_all(v): if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} else: return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) -@cache.memoize() +@cache.memoize(timeout=86400) def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs): posts = g.db.query(Submission).options(lazyload('*')).filter_by(is_banned=False, private=False,).filter(Submission.deleted_utc == 0) @@ -340,7 +340,7 @@ def random_post(v): post = x.order_by(Submission.id.asc()).offset(n).limit(1).first() return redirect(post.permalink) -@cache.memoize() +@cache.memoize(timeout=86400) def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs): posts = g.db.query(Submission).options(lazyload('*'))