You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GrpcStreamBroadcaster.new_receiver(include_events=True)merges two independently buffered receivers, one for data and one for events. The broadcaster sends events and data in order, but the merged receiver doesn't preserve the order between the two buffers.
I reproduced data arriving before StreamStarted, and StreamFatalError arriving ahead of the last two queued data items. The documented example stops reading when it receives StreamFatalError, so a caller following it can miss data the broadcaster had already sent.
What did you expect instead?
A mixed receiver should yield events and data in the order the broadcaster sent them, except for messages dropped if the receiver's buffer fills. A terminal event should not jump ahead of data that's already queued. Data-only receivers should be unaffected.
Affected version(s)
Confirmed in the v0.11.5 code with frequenz-channels 2.0.1.
Affected part(s)
Code (part:code)
Extra information
One option is a single FIFO for mixed receivers. That would also make maxsize a shared capacity for events and data, rather than a separate limit for each, so the buffering behavior should be decided and documented. Add a test that queues several data items and a terminal event before reading, then asserts their relative order. This overlaps with the receiver code in #281, which still merges the two buffers.
Activity