Clean expired API keys every 24h

If someone logs in, then never logs back in while the key expires, then the key is stored in the dict and never deleted. So every 24 hours delete all keys that have been expired for more than 24 hours. Avoids a memory leak-like situation.
This commit is contained in:
CasVT
2025-08-26 02:30:01 +02:00
parent 515ef665a2
commit d4d6d0973c
2 changed files with 27 additions and 2 deletions

View File

@@ -55,6 +55,7 @@ class Constants:
ADMIN_API_EXTENSION = "/admin"
ADMIN_PREFIX = API_PREFIX + ADMIN_API_EXTENSION
API_KEY_LENGTH = 32 # hexadecimal characters
API_KEY_CLEANUP_INTERVAL = 86400 # seconds
DB_FOLDER = ("db",)
DB_NAME = "MIND.db"