33from pydantic import BaseModel
44from sql import selectQuery , insertQuery
55from globals import (
6- redis_client ,
7- config ,
8- append_request_log ,
96 set_cache ,
107 get_cache ,
118)
@@ -48,7 +45,6 @@ def insertBonus(
4845 """Inserts a new record to the table\n
4946 ```char sql_insertLatestRecords[] = ....```"""
5047 tic = time .perf_counter ()
51- append_request_log (request )
5248
5349 sql = surftimer .queries .sql_insertBonus .format (
5450 data .steamid32 ,
@@ -73,7 +69,6 @@ def insertBonus(
7369 # Prepare the response
7470 toc = time .perf_counter ()
7571 print (f"Execution time { toc - tic :0.4f} " )
76- # output = ResponseInsertQuery(xquery)
7772
7873 return {"inserted" : xquery , "xtime" : time .perf_counter () - tic }
7974
@@ -90,7 +85,6 @@ def updateBonus(
9085):
9186 """```char sql_updateBonus[] = ....```"""
9287 tic = time .perf_counter ()
93- append_request_log (request )
9488
9589 sql = surftimer .queries .sql_updateBonus .format (
9690 data .runtime ,
@@ -127,10 +121,8 @@ def selectBonusCount(request: Request, response: Response, mapname: str):
127121 ```char sql_selectBonusCount[] = ....```"""
128122 tic = time .perf_counter ()
129123
130- append_request_log (request )
131-
132124 # Check if data is cached in Redis
133- cache_key = f"selectBonusCount_ { mapname } "
125+ cache_key = f"selectBonusCount: { mapname } "
134126 cached_data = get_cache (cache_key )
135127 if cached_data :
136128 print (f"[Redis] Loaded '{ cache_key } ' ({ time .perf_counter () - tic :0.4f} s)" )
@@ -166,8 +158,6 @@ def selectPersonalBonusRecords(
166158 """```char sql_selectPersonalBonusRecords[] = ....```"""
167159 tic = time .perf_counter ()
168160
169- append_request_log (request )
170-
171161 # Check if data is cached in Redis
172162 cache_key = f"selectPersonalBonusRecords:{ steamid32 } -{ mapname } "
173163 cached_data = get_cache (cache_key )
@@ -211,7 +201,6 @@ def selectPlayerRankBonus(
211201 """```char sql_selectPlayerRankBonus[] = ....```"""
212202 tic = time .perf_counter ()
213203
214- append_request_log (request )
215204 cache_key = (
216205 f"selectPlayerRankBonus:{ data .steamid32 } -{ data .mapname } -{ data .zonegroup } "
217206 )
@@ -262,8 +251,6 @@ def selectFastestBonus(
262251 """```char sql_selectFastestBonus[] = ....```"""
263252 tic = time .perf_counter ()
264253
265- append_request_log (request )
266-
267254 # Check if data is cached in Redis
268255 cache_key = f"selectFastestBonus:{ mapname } "
269256 cached_data = get_cache (cache_key )
@@ -303,8 +290,6 @@ def selectAllBonusTimesinMap(
303290 """```char sql_selectAllBonusTimesinMap[] = ....```"""
304291 tic = time .perf_counter ()
305292
306- append_request_log (request )
307-
308293 # Check if data is cached in Redis
309294 cache_key = f"selectAllBonusTimesinMap:{ mapname } "
310295 cached_data = get_cache (cache_key )
@@ -346,8 +331,6 @@ def selectTopBonusSurfers(
346331 """```char sql_selectTopBonusSurfers[] = ....```"""
347332 tic = time .perf_counter ()
348333
349- append_request_log (request )
350-
351334 # Check if data is cached in Redis
352335 cache_key = f"selectTopBonusSurfers:{ mapname } -{ style } -{ zonegroup } "
353336 cached_data = get_cache (cache_key )
@@ -394,8 +377,6 @@ def deleteBonus(
394377 """```char sql_deleteBonus[] = ....```"""
395378 tic = time .perf_counter ()
396379
397- append_request_log (request )
398-
399380 xquery = insertQuery (surftimer .queries .sql_deleteBonus .format (mapname ))
400381
401382 if xquery <= 0 :
0 commit comments