mirror of
https://github.com/norohind/FDEV-CAPI-Handler.git
synced 2026-10-29 01:26:02 +03:00
Introduce mechanism to skip token use counter update
This commit is contained in:
2 files changed
+6
-2
No files matched your search
+4
-2
@@ -1,6 +1,7 @@
|
||||
import sqlite3
|
||||
from typing import Union
|
||||
|
||||
import config
|
||||
from . import sqlite_requests
|
||||
from EDMCLogging import get_main_logger
|
||||
|
||||
@@ -129,8 +130,9 @@ class Model:
|
||||
def get_token_for_user(self, state: str) -> dict:
|
||||
sql_params = {'state': state}
|
||||
token = self.db.execute(sqlite_requests.get_token_for_user, sql_params).fetchone()
|
||||
with self.db:
|
||||
self.db.execute(sqlite_requests.increment_usages, sql_params)
|
||||
if not config.do_skip_token_usage_increment:
|
||||
with self.db:
|
||||
self.db.execute(sqlite_requests.increment_usages, sql_params)
|
||||
|
||||
return token
|
||||
|
||||
|
||||
Reference in new issue
Block a user