Non-blocking fan-out. Safe to call from any async context.
(self, event: dict[str, Any])
| 32 | self._subscribers.discard(queue) |
| 33 | |
| 34 | def publish(self, event: dict[str, Any]) -> None: |
| 35 | """Non-blocking fan-out. Safe to call from any async context.""" |
| 36 | for queue in list(self._subscribers): |
| 37 | try: |
| 38 | queue.put_nowait(event) |
| 39 | except asyncio.QueueFull: |
| 40 | try: |
| 41 | queue.put_nowait({"type": "dropped", "reason": "queue_full"}) |
| 42 | except asyncio.QueueFull: |
| 43 | pass |
| 44 | except Exception: |
| 45 | log.exception("event publish failed") |
| 46 | |
| 47 | @property |
| 48 | def subscriber_count(self) -> int: |
no outgoing calls
no test coverage detected