replay: delay per complete frame instead of per chunk

ReplayPacer (MsgListener+MsgTalker) sits between packetizer output and
downstream listeners; sleeps after each complete NMEA/UBX frame before
forwarding. FileBackend no longer owns the delay — it reads as fast as
possible and the pacer provides back-pressure on the same thread.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 13:11:40 +02:00
co-authored by Claude Sonnet 4.6
parent ff686b64f7
commit dce570460e
4 changed files with 58 additions and 26 deletions
+3 -15
View File
@@ -1,5 +1,4 @@
import re
import time
from threading import Thread
from backend.a_backend import ABackend
@@ -15,20 +14,11 @@ def source_id_from_path(path: str) -> str | None:
class FileBackend(ABackend):
def __init__(self, files: list[str], delay: float = 1.0):
self._delay = max(0.0, min(10.0, delay))
def __init__(self, files: list[str]):
self._entries = [{'path': p, 'source_id': source_id_from_path(p), 'xcvr': None, 'file': None, 'thread': None}
for p in files]
self._running = False
@property
def delay(self) -> float:
return self._delay
@delay.setter
def delay(self, value: float):
self._delay = max(0.0, min(10.0, value))
def register_xcvr(self, xcvr):
for e in self._entries:
if e['source_id'] == xcvr.name.strip():
@@ -56,7 +46,7 @@ class FileBackend(ABackend):
self._running = False
for e in self._entries:
if e['thread'] and e['thread'].is_alive():
e['thread'].join(timeout=self._delay + 1.0)
e['thread'].join(timeout=2.0)
def join(self):
for e in self._entries:
@@ -77,6 +67,4 @@ class FileBackend(ABackend):
if not data:
break
if xcvr:
xcvr.on_recv(MsgContainer(data, xcvr))
if self._delay > 0:
time.sleep(self._delay)
xcvr.on_recv(MsgContainer(data, xcvr))