remove thread during log
This commit is contained in:
parent
ac2589278b
commit
b44bc8b55b
11
analytics.py
11
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.
|
||||
|
||||
5
app.py
5
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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user