diff --git a/analytics.py b/analytics.py index 2de43a3..c04a457 100644 --- a/analytics.py +++ b/analytics.py @@ -9,16 +9,13 @@ 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 + if cls not in cls._instances: + instance = super().__call__(*args, **kwargs) + cls._instances[cls] = instance return cls._instances[cls] # Database class that only handles the connection. diff --git a/app.py b/app.py index fee0c9f..46ab0e1 100755 --- a/app.py +++ b/app.py @@ -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