change redis default timeout to prevent future confusion (like what happened)
parent
3344d9d74a
commit
33c043b42f
|
@ -50,7 +50,7 @@ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|||
app.config["CACHE_KEY_PREFIX"] = f"{SITE}_flask_cache_"
|
||||
app.config["CACHE_TYPE"] = "RedisCache"
|
||||
app.config["CACHE_REDIS_URL"] = environ.get("REDIS_URL").strip()
|
||||
app.config["CACHE_DEFAULT_TIMEOUT"] = 86400
|
||||
app.config["CACHE_DEFAULT_TIMEOUT"] = 0
|
||||
app.config["CACHE_SOURCE_CHECK"] = True
|
||||
|
||||
#to allow session cookie to work on videos.watchpeopledie.tv
|
||||
|
|
|
@ -401,4 +401,4 @@ def _set_top_poster_of_the_day_id():
|
|||
send_notification(user.id, f":marseyjam: You're the Top Poster of the Day for the day of {t.year}-{t.month}-{t.day} :marseyjam:")
|
||||
badge_grant(badge_id=327, user=user)
|
||||
|
||||
cache.set("top_poster_of_the_day_id", user.id)
|
||||
cache.set("top_poster_of_the_day_id", user.id, timeout=86400)
|
||||
|
|
|
@ -35,7 +35,7 @@ messages = cache.get(f'messages') or {}
|
|||
online = {}
|
||||
typing = []
|
||||
|
||||
cache.set('loggedin_chat', len(online), timeout=0)
|
||||
cache.set('loggedin_chat', len(online), timeout=86400)
|
||||
|
||||
def auth_required_socketio(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
|
@ -179,7 +179,7 @@ def refresh_online():
|
|||
|
||||
data = [list(online.values()), muted]
|
||||
emit("online", data, room="chat", broadcast=True)
|
||||
cache.set('loggedin_chat', len(online), timeout=0)
|
||||
cache.set('loggedin_chat', len(online), timeout=86400)
|
||||
|
||||
@socketio.on('connect')
|
||||
@auth_required_socketio
|
||||
|
@ -244,8 +244,8 @@ def delete(id, v):
|
|||
|
||||
|
||||
def close_running_threads():
|
||||
cache.set('messages', messages)
|
||||
cache.set('muted', muted)
|
||||
cache.set('messages', messages, timeout=86400)
|
||||
cache.set('muted', muted, timeout=86400)
|
||||
atexit.register(close_running_threads)
|
||||
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ LIMITED_WPD_HOLES = {'aftermath', 'fights', 'gore', 'medical', 'request', 'selfh
|
|||
'countryclub', 'highrollerclub',
|
||||
'slavshit', 'sandshit'}
|
||||
|
||||
@cache.memoize()
|
||||
@cache.memoize(timeout=86400)
|
||||
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', gt=0, lt=0, hole=None, pins=True, effortposts_only=False, hide_cw=False):
|
||||
posts = g.db.query(Post)
|
||||
|
||||
|
@ -241,7 +241,7 @@ def random_user(v):
|
|||
|
||||
return redirect(f"/@{u}")
|
||||
|
||||
@cache.memoize()
|
||||
@cache.memoize(timeout=86400)
|
||||
def comment_idlist(v=None, page=1, sort="new", t="day", gt=0, lt=0):
|
||||
comments = g.db.query(Comment) \
|
||||
.outerjoin(Comment.post) \
|
||||
|
|
|
@ -134,7 +134,7 @@ def bar_position():
|
|||
|
||||
return [int((vaxxed * 100) / total), int((zombie * 100) / total), vaxxed, zombie]
|
||||
|
||||
@cache.cached(make_cache_key=lambda:"emoji_count")
|
||||
@cache.cached(make_cache_key=lambda:"emoji_count", timeout=86400)
|
||||
def emoji_count():
|
||||
return g.db.query(Emoji).filter_by(submitter_id=None).count()
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ def me(v):
|
|||
def logout(v):
|
||||
loggedin = cache.get('loggedin') or {}
|
||||
if session.get("lo_user") in loggedin: del loggedin[session["lo_user"]]
|
||||
cache.set('loggedin', loggedin)
|
||||
cache.set('loggedin', loggedin, timeout=86400)
|
||||
session.pop("lo_user", None)
|
||||
return {"message": "Logout successful!"}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ def validate_formkey(u, formkey):
|
|||
if not formkey: return False
|
||||
return validate_hash(get_raw_formkey(u), formkey)
|
||||
|
||||
@cache.memoize()
|
||||
@cache.memoize(timeout=86400)
|
||||
def get_alt_graph_ids(uid):
|
||||
alt_graph_cte = g.db.query(literal(uid).label('user_id')).select_from(Alt).cte('alt_graph', recursive=True)
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
# ORDER BY payout DESC, bets_won DESC, bets_total ASC;
|
||||
# """)
|
||||
|
||||
# @cache.memoize()
|
||||
# @cache.memoize(timeout=86400)
|
||||
# def _special_leaderboard_get():
|
||||
# result = g.db.execute(_special_leaderboard_query).all()
|
||||
# return result
|
||||
|
|
|
@ -47,7 +47,7 @@ def reddit_post(subreddit, v, path):
|
|||
def marseys_redirect():
|
||||
return redirect("/emojis/marsey")
|
||||
|
||||
@cache.cached(make_cache_key=lambda kind, nsfw:f"emoji_list_{kind}_{nsfw}")
|
||||
@cache.cached(make_cache_key=lambda kind, nsfw:f"emoji_list_{kind}_{nsfw}", timeout=86400)
|
||||
def get_emoji_list(kind, nsfw):
|
||||
emojis = g.db.query(Emoji).filter(Emoji.submitter_id == None, Emoji.kind == kind)
|
||||
|
||||
|
@ -85,7 +85,7 @@ def emoji_list(v, kind):
|
|||
|
||||
|
||||
|
||||
@cache.cached(make_cache_key=lambda nsfw:f"emojis_{nsfw}")
|
||||
@cache.cached(make_cache_key=lambda nsfw:f"emojis_{nsfw}", timeout=86400)
|
||||
def get_emojis(nsfw):
|
||||
emojis = g.db.query(Emoji, User).join(User, Emoji.author_id == User.id).options(load_only(
|
||||
User.id,
|
||||
|
|
|
@ -1006,7 +1006,7 @@ def u_username(v, username):
|
|||
total=total,
|
||||
is_following=is_following)
|
||||
|
||||
@cache.memoize()
|
||||
@cache.memoize(timeout=86400)
|
||||
def userpagelisting(u, v=None, page=1, sort="new", t="all"):
|
||||
posts = g.db.query(Post).filter_by(author_id=u.id, profile_pinned=False).options(load_only(Post.id))
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ def calc_users():
|
|||
|
||||
loggedin = {k: v for k, v in loggedin.items() if (timestamp - v) < LOGGEDIN_ACTIVE_TIME}
|
||||
loggedout = {k: v for k, v in loggedout.items() if (timestamp - v[0]) < LOGGEDIN_ACTIVE_TIME}
|
||||
cache.set(LOGGED_IN_CACHE_KEY, loggedin)
|
||||
cache.set(LOGGED_OUT_CACHE_KEY, loggedout)
|
||||
cache.set(LOGGED_IN_CACHE_KEY, loggedin, timeout=86400)
|
||||
cache.set(LOGGED_OUT_CACHE_KEY, loggedout, timeout=86400)
|
||||
g.loggedin_counter = len(loggedin)
|
||||
g.loggedout_counter = len(loggedout)
|
||||
|
||||
|
|
Loading…
Reference in New Issue