fix: get account count not using global variable
All checks were successful
Build Docker / Build Main Image (push) Successful in 20s
All checks were successful
Build Docker / Build Main Image (push) Successful in 20s
This commit is contained in:
parent
f1e0d1b5dc
commit
c3da1ffff3
8
db.py
8
db.py
@ -63,6 +63,7 @@ def get_link_count():
|
|||||||
|
|
||||||
def get_account_count():
|
def get_account_count():
|
||||||
global last_check_account
|
global last_check_account
|
||||||
|
global accounts
|
||||||
if time.time() - last_check_account < 60:
|
if time.time() - last_check_account < 60:
|
||||||
return accounts
|
return accounts
|
||||||
|
|
||||||
@ -72,15 +73,16 @@ def get_account_count():
|
|||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
connection.close()
|
connection.close()
|
||||||
last_check_account = time.time()
|
|
||||||
if result == None:
|
if result == None:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
accounts = []
|
accounts = []
|
||||||
for link in result:
|
for link in result:
|
||||||
if link[1] not in accounts:
|
if link[1] not in accounts:
|
||||||
accounts.append(link[1])
|
accounts.append(link[1])
|
||||||
return len(accounts)
|
accounts = len(accounts)
|
||||||
|
last_check_account = time.time()
|
||||||
|
return accounts
|
||||||
|
|
||||||
def delete_token(token):
|
def delete_token(token):
|
||||||
connection = mysql.connector.connect(**dbargs)
|
connection = mysql.connector.connect(**dbargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user