some fixes

This commit is contained in:
Ayzen
2026-06-06 02:07:46 +03:00
parent b3a8cd834f
commit c12ae05148
2 changed files with 109 additions and 6 deletions
@@ -142,6 +142,14 @@ class AppWindowPipelineMixin:
self._log("History reset because run settings changed")
self._history_run_signature = run_signature
# Open the single-capture acquisition window BEFORE the producer can emit:
# any collection the one-shot orchestrator publishes is then strictly newer
# than this timestamp and is recognized as the target. Reading the clock
# AFTER start() raced a fast (simulator) orchestrator that had already
# published — its collection.monotonic_ns < start_ns, so the capture never
# completed and the GUI hung.
single_capture_start_ns = time.monotonic_ns() if single_capture else None
self._supervisor.start(config_path, allow_clean_orchestrator_exit=single_capture)
self._close_readers()
self._raw_reader = ShmRingReader(config.rings.raw_tap.name)
@@ -149,13 +157,16 @@ class AppWindowPipelineMixin:
self._result_reader = ShmRingReader(config.rings.results.name)
self._processor_run_signature = processor_signature
self._single_capture_active = single_capture
self._single_capture_start_ns = None
self._single_capture_start_ns = single_capture_start_ns
self._single_capture_seen_raw = False
self._single_capture_target_collection_id = None
# Always drop unread payloads for all stages so single-capture starts
# from a clean boundary and does not retain stale results-only tail.
self._drop_pending_ring_payloads(include_results=True)
if not single_capture:
# Continuous start: discard any stale tail so rendering begins fresh.
# Single capture must NOT drop here — the drop races with (and can
# discard) the one-shot result; it instead filters stale data by the
# start timestamp recorded above.
self._drop_pending_ring_payloads(include_results=True)
self._last_reader_error_signature = None
self._reader_error_repeat_count = 0
# Record what to relaunch if a child later dies unexpectedly. Only a
@@ -164,8 +175,6 @@ class AppWindowPipelineMixin:
self._active_run_config_path = config_path
self._pipeline_should_run = not single_capture
self._pipeline_restart_count = 0
if single_capture:
self._single_capture_start_ns = time.monotonic_ns()
pid_map = self._supervisor.pids()
pid_text = ", ".join(f"{name}={pid}" for name, pid in sorted(pid_map.items())) or "none"