fix: initialize stats_last_write inside main() to avoid UnboundLocalError
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user