feat(perception): qualify E33 worker shadow

This commit is contained in:
DCCONSTRUCTIONS
2026-07-27 13:43:18 +03:00
parent 32257fc2b4
commit 9bbd5845b7
13 changed files with 2448 additions and 9 deletions
+6 -2
View File
@@ -592,17 +592,21 @@ class LatestWinsQueue[T]:
self._dropped_superseded = 0
self._closed = False
def publish(self, item: T) -> None:
def publish(self, item: T) -> T | None:
"""Publish fresh work and return the evicted oldest item, if any."""
with self._condition:
if self._closed:
raise RuntimeError("cannot publish to a closed latest-wins queue")
dropped: T | None = None
if len(self._items) == self._capacity:
self._items.popleft()
dropped = self._items.popleft()
self._dropped_overflow += 1
self._items.append(item)
self._published += 1
self._maximum_depth = max(self._maximum_depth, len(self._items))
self._condition.notify()
return dropped
def take_next(self, timeout: float | None = None) -> T | None:
with self._condition: