Add cachelock and fixed dashboard redirecting

This commit is contained in:
Jeremy Zhang 2017-04-26 22:19:13 +00:00
parent 1daa21d930
commit fd5cc7eb2a
2 changed files with 4 additions and 1 deletions

View File

@ -62,7 +62,8 @@ def dashboard():
if not guilds: if not guilds:
session["redirect"] = url_for("user.dashboard") session["redirect"] = url_for("user.dashboard")
return redirect(url_for("user.logout")) return redirect(url_for("user.logout"))
if session["redirect"]: error = request.args.get("error")
if session["redirect"] and not (error and error == "access_denied"):
redir = session['redirect'] redir = session['redirect']
session['redirect'] = None session['redirect'] = None
return redirect(redir) return redirect(redir)
@ -77,6 +78,7 @@ def administrate_guild(guild_id):
if guild['code'] != 200: if guild['code'] != 200:
session["redirect"] = url_for("user.administrate_guild", guild_id=guild_id, _external=True) session["redirect"] = url_for("user.administrate_guild", guild_id=guild_id, _external=True)
return redirect(generate_bot_invite_url(guild_id)) return redirect(generate_bot_invite_url(guild_id))
session["redirect"] = None
db_guild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first() db_guild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
if not db_guild: if not db_guild:
db_guild = Guilds(guild_id) db_guild = Guilds(guild_id)

View File

@ -10,6 +10,7 @@ import hashlib
cache_opts = { cache_opts = {
'cache.type': 'ext:database', 'cache.type': 'ext:database',
'cache.lock_dir': 'tmp/cachelock',
'cache.url': config["database-uri"], 'cache.url': config["database-uri"],
'cache.sa.pool_recycle': 250, 'cache.sa.pool_recycle': 250,
} }