.BANCHO. Move bancho sessions to redis
This commit is contained in:
parent
3bc390e3e6
commit
525235a27e
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 369415b54e0dd8892fe557f0b7fb29c3933fc19e
|
Subproject commit 1dce6bc5b40fdfaca3064d5f2d23ca7dd1598256
|
|
@ -185,12 +185,16 @@ class tokenList:
|
||||||
|
|
||||||
def deleteBanchoSessions(self):
|
def deleteBanchoSessions(self):
|
||||||
"""
|
"""
|
||||||
Truncate bancho_sessions table.
|
Remove all `peppy:sessions:*` redis keys.
|
||||||
Call at bancho startup to delete old cached sessions
|
Call at bancho startup to delete old cached sessions
|
||||||
|
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
glob.db.execute("TRUNCATE TABLE bancho_sessions")
|
try:
|
||||||
|
# TODO: Make function or some redis meme
|
||||||
|
glob.redis.eval("return redis.call('del', unpack(redis.call('keys', ARGV[1])))", 0, "peppy:sessions:*")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def tokenExists(self, username = "", userID = -1):
|
def tokenExists(self, username = "", userID = -1):
|
||||||
|
|
1
pep.py
1
pep.py
|
@ -114,6 +114,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# Empty redis cache
|
# Empty redis cache
|
||||||
try:
|
try:
|
||||||
|
# TODO: Make function or some redis meme
|
||||||
glob.redis.eval("return redis.call('del', unpack(redis.call('keys', ARGV[1])))", 0, "peppy:*")
|
glob.redis.eval("return redis.call('del', unpack(redis.call('keys', ARGV[1])))", 0, "peppy:*")
|
||||||
except redis.exceptions.ResponseError:
|
except redis.exceptions.ResponseError:
|
||||||
# Script returns error if there are no keys starting with peppy:*
|
# Script returns error if there are no keys starting with peppy:*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user