From c3da1ffff3fdf3ba6a6ccf5e200dc83e5ca6847b Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Fri, 17 Nov 2023 11:29:24 +1100 Subject: [PATCH] fix: get account count not using global variable --- db.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db.py b/db.py index 97966f0..0b045f8 100644 --- a/db.py +++ b/db.py @@ -63,6 +63,7 @@ def get_link_count(): def get_account_count(): global last_check_account + global accounts if time.time() - last_check_account < 60: return accounts @@ -72,15 +73,16 @@ def get_account_count(): result = cursor.fetchall() cursor.close() connection.close() - last_check_account = time.time() if result == None: return 0 - + accounts = [] for link in result: if link[1] not in accounts: accounts.append(link[1]) - return len(accounts) + accounts = len(accounts) + last_check_account = time.time() + return accounts def delete_token(token): connection = mysql.connector.connect(**dbargs)