expand thread caching
parent
7493722457
commit
f33f0647a9
|
@ -400,8 +400,9 @@ def comment(v:User):
|
|||
|
||||
g.db.flush()
|
||||
|
||||
if SITE == 'watchpeopledie.tv' and c.parent_post:
|
||||
cache.delete(f'post_{c.parent_post}')
|
||||
if c.parent_post:
|
||||
for sort in COMMENT_SORTS:
|
||||
cache.delete(f'post_{c.parent_post}_{sort}')
|
||||
|
||||
if v.client: return c.json
|
||||
return {"comment": render_template("comments.html", v=v, comments=[c])}
|
||||
|
|
|
@ -96,15 +96,15 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
p.views += 1
|
||||
g.db.add(p)
|
||||
|
||||
if SITE == 'watchpeopledie.tv' and not v and not request.values.get("sort"):
|
||||
result = cache.get(f'post_{p.id}')
|
||||
if result: return result
|
||||
|
||||
if p.new: defaultsortingcomments = 'new'
|
||||
elif v: defaultsortingcomments = v.defaultsortingcomments
|
||||
else: defaultsortingcomments = "hot"
|
||||
sort = request.values.get("sort", defaultsortingcomments)
|
||||
|
||||
if not v:
|
||||
result = cache.get(f'post_{p.id}_{sort}')
|
||||
if result: return result
|
||||
|
||||
if v:
|
||||
execute_shadowban_viewers_and_voters(v, p)
|
||||
# shadowban check is done in sort_objects
|
||||
|
@ -184,8 +184,8 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
sort=sort, render_replies=True, offset=offset, sub=p.subr,
|
||||
fart=get_setting('fart_mode'))
|
||||
|
||||
if SITE == 'watchpeopledie.tv' and not v and not request.values.get("sort"):
|
||||
cache.set(f'post_{p.id}', result)
|
||||
if not v:
|
||||
cache.set(f'post_{p.id}_{sort}', result)
|
||||
|
||||
return result
|
||||
|
||||
|
|
Loading…
Reference in New Issue