This commit is contained in:
mvdbeek
2026-04-28 17:17:17 +02:00
parent 8d12bff9b9
commit 2515edacfc
6 changed files with 14 additions and 10 deletions
+2 -2
View File
@@ -15,13 +15,13 @@ from collections import (
defaultdict,
OrderedDict,
)
from collections.abc import Iterator
from datetime import (
datetime,
timedelta,
)
from typing import (
Any,
Iterator,
Optional,
)
@@ -120,7 +120,7 @@ class HistoryAuditMonitor:
self._thread: Optional[threading.Thread] = None
self._active = False
# Bounded LRU cache: history_id -> user_id, refreshed on miss.
self._history_owner_cache: "OrderedDict[int, int]" = OrderedDict()
self._history_owner_cache: OrderedDict[int, int] = OrderedDict()
def start(self) -> None:
if self._active:
+5 -3
View File
@@ -8,12 +8,14 @@ to async SSE endpoint handlers running in the uvicorn event loop.
import asyncio
import logging
from collections import defaultdict
from dataclasses import dataclass
from datetime import datetime
from typing import (
from collections.abc import (
AsyncIterator,
Awaitable,
Callable,
)
from dataclasses import dataclass
from datetime import datetime
from typing import (
Optional,
)
+1 -1
View File
@@ -7,8 +7,8 @@ configuration. When notifications are disabled the catch-up event is simply
skipped; the stream still delivers other push events.
"""
from collections.abc import AsyncIterator
from typing import (
AsyncIterator,
Optional,
)
@@ -1,6 +1,6 @@
from collections.abc import AsyncIterator
from datetime import datetime
from typing import (
AsyncIterator,
NoReturn,
Optional,
Union,
+2 -2
View File
@@ -71,7 +71,7 @@ class SSELineListener:
self._collected: list[str] = []
self._stop = threading.Event()
self._ready = threading.Event()
self._errors: "queue.Queue[BaseException]" = queue.Queue()
self._errors: queue.Queue[BaseException] = queue.Queue()
self._thread = threading.Thread(target=self._listen, daemon=True)
def start(self) -> None:
@@ -130,7 +130,7 @@ class SSELineListener:
if self._stop.is_set():
break
resp.close()
except BaseException as exc:
except Exception as exc:
self._errors.put(exc)
# Ensure start() doesn't hang forever on connection failure.
self._ready.set()
@@ -129,5 +129,7 @@ class TestNotificationSSESeleniumIntegration(SeleniumIntegrationTestCase):
self._wait_for_sse_event_after(baseline_ts)
# The indicator dot should appear on the bell (within the #activity-notifications element)
self.driver.wait_for_selector_visible("#activity-notifications .indicator", timeout=SSE_EVENT_TIMEOUT_SECONDS * 1000)
self.driver.wait_for_selector_visible(
"#activity-notifications .indicator", timeout=SSE_EVENT_TIMEOUT_SECONDS * 1000
)
self.screenshot("notification_bell_indicator")