fix: use threading.Lock() instead of object() for _stats_lock

This commit is contained in:
2026-06-24 02:42:06 -07:00
parent f673da4b3b
commit 74e0d3fa03
+2 -2
View File
@@ -6,7 +6,7 @@ to UDP ports for Pd (8081) and LED matrix visualization (8082).
Writes metrics to /tmp/midi-stats.json for prometheus-exporter to collect. Writes metrics to /tmp/midi-stats.json for prometheus-exporter to collect.
""" """
import os, socket, time, select, pathlib, json import os, socket, time, select, pathlib, json, threading
PD_HOST = os.environ.get("MIDI_BRIDGE_HOST", "127.0.0.1") PD_HOST = os.environ.get("MIDI_BRIDGE_HOST", "127.0.0.1")
PD_PORT = int(os.environ.get("MIDI_BRIDGE_PORT", "8081")) PD_PORT = int(os.environ.get("MIDI_BRIDGE_PORT", "8081"))
@@ -22,7 +22,7 @@ last_status = 0
last_note = 0 last_note = 0
last_velocity = 0 last_velocity = 0
last_time = 0.0 last_time = 0.0
_stats_lock = object() _stats_lock = threading.Lock()
def _find_midi_dev(): def _find_midi_dev():