fix(thread-safety): lock disc_entries reads/writes in HookServer, remove debug logs

This commit is contained in:
2026-03-02 10:37:33 -05:00
parent eb293f3c96
commit 57efca4f9b
3 changed files with 5 additions and 5 deletions

View File

@@ -34,8 +34,10 @@ class HookHandler(BaseHTTPRequestHandler):
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
with app._disc_entries_lock:
entries_snapshot = list(app.disc_entries)
self.wfile.write(
json.dumps({'session': {'entries': app.disc_entries}}).
json.dumps({'session': {'entries': entries_snapshot}}).
encode('utf-8'))
elif self.path == '/api/performance':
self.send_response(200)
@@ -211,7 +213,8 @@ class HookHandler(BaseHTTPRequestHandler):
self.send_response(500)
self.end_headers()
elif self.path == '/api/session':
app.disc_entries = data.get('session', {}).get('entries', app.disc_entries)
with app._disc_entries_lock:
app.disc_entries = data.get('session', {}).get('entries', app.disc_entries)
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()