fix: initialize stats_last_write inside main() to avoid UnboundLocalError

This commit is contained in:
2026-06-24 02:39:37 -07:00
parent ad55dbc5e0
commit 7706517b88
+3 -2
View File
@@ -94,6 +94,7 @@ def main():
frames_sent = 0
frames_dropped = 0
router_errors = 0
stats_last_write = time.monotonic()
while True:
now = time.monotonic()
@@ -193,9 +194,9 @@ def main():
last_frame = frame
# Write stats periodically (every 2s)
if now - _stats_last_write >= 2.0:
if now - stats_last_write >= 2.0:
_write_stats(frames_sent, frames_dropped, pending_frames)
_stats_last_write = now
stats_last_write = now
_stats_last_write = 0.0