mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-08 00:37:38 +08:00
[Refactor] Performance optimization
- Put download token in memory database - Accelerate multiple querying in `best_score` table
This commit is contained in:
@@ -29,12 +29,14 @@ def game_info():
|
||||
@auth_required(request)
|
||||
@arc_try
|
||||
def download_song(user_id):
|
||||
with Connect() as c:
|
||||
x = DownloadList(c, UserOnline(c, user_id))
|
||||
with Connect(in_memory=True) as c:
|
||||
x = DownloadList(c, UserOnline(None, user_id))
|
||||
x.song_ids = request.args.getlist('sid')
|
||||
x.url_flag = json.loads(request.args.get('url', 'true'))
|
||||
if x.url_flag and x.is_limited:
|
||||
raise RateLimit('You have reached the download limit.', 903)
|
||||
if x.url_flag:
|
||||
x.clear_download_token()
|
||||
|
||||
x.add_songs()
|
||||
return success_return(x.urls)
|
||||
|
||||
Reference in New Issue
Block a user