remove thread during log

This commit is contained in:
lelo 2025-03-31 18:22:17 +00:00
parent ac2589278b
commit b44bc8b55b
2 changed files with 5 additions and 11 deletions

View File

@ -9,13 +9,10 @@ import psycopg2
file_access_temp = []
# Thread-safe singleton metaclass.
# singleton metaclass.
class SingletonMeta(type):
_instances = {}
_lock = threading.Lock() # Ensures thread safety.
def __call__(cls, *args, **kwargs):
with cls._lock:
if cls not in cls._instances:
instance = super().__call__(*args, **kwargs)
cls._instances[cls] = instance

5
app.py
View File

@ -269,10 +269,7 @@ def serve_file(subpath):
logging = True
if logging:
threading.Thread(
target=a.log_file_access,
args=(subpath, filesize, mime, ip_address, user_agent, session['device_id'], bool(cached), )
).start()
a.log_file_access(subpath, filesize, mime, ip_address, user_agent, session['device_id'], bool(cached))
return response