[Enhance] Performance optimization

- Change journal mode to WAL and enlarge cache size for sqlite3 database
- Use monkey patch to do asynchrony
- Make gevent use Flask's logger
This commit is contained in:
Lost-MSth
2022-10-31 17:49:19 +08:00
parent 40630fff4d
commit 4da3f38f6e
6 changed files with 28 additions and 15 deletions

View File

@@ -258,13 +258,17 @@ class UserPlay(UserScore):
def get_play_state(self) -> None:
'''检查token当然这里不管有没有是用来判断世界模式和课题模式的'''
if self.token == '1145141919810':
# 硬编码检查,绕过数据库
self.is_world_mode = False
self.course_play_state = -1
return None
self.c.execute(
'''select * from songplay_token where token=:a ''', {'a': self.song_token})
x = self.c.fetchone()
if not x:
self.is_world_mode = False
self.course_play_state = -1
return None
raise NoData('No token data.')
self.song.set_chart(x[2], x[3])
if x[4]:
self.course_play = CoursePlay(self.c, self.user, self)