fix(api): StreamsBroadcastChannel start reading messages from the end

Setting initial `_last_id` to `0-0` would causing every
subscription to receive one copy of the event stream,
which is  not compatible with the current frontend / backend communication protocol.
This commit is contained in:
QuantumGhost 2026-03-24 22:28:54 +08:00
parent 0c3d11f920
commit 7c207327e3
1 changed files with 4 additions and 1 deletions

View File

@ -64,7 +64,10 @@ class _StreamsSubscription(Subscription):
self._client = client
self._key = key
self._closed = threading.Event()
self._last_id = "0-0"
# Setting initial last id to `$` to signal redis that we only want new messages.
#
# ref: https://redis.io/docs/latest/commands/xread/#the-special--id
self._last_id = "$"
self._queue: queue.Queue[object] = queue.Queue()
self._start_lock = threading.Lock()
self._listener: threading.Thread | None = None