fix: avoid missed wakeups in rpc stream subscribe#1184
Conversation
|
PR author is not in the allowed authors list. |
|
two concerns before merge:
minor: |
aljo242
left a comment
There was a problem hiding this comment.
silent behavior change in Subscribe offset, missing regression tests, unnecessary export of Channel().
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days-before-close if no further activity occurs. |
Description
Fix the rpc stream subscription race that could miss the final wakeup in blocking reads.
Initialize subscription offsets from the current tail so subscribers only receive new items.
Capture the cond channel before releasing the read lock to avoid dropped broadcasts.
Verification
go test -count=20 -race -tags=test ./rpc/stream -run 'TestStream(ReadBlocking|Subscribe)'
go test -race -tags=test ./rpc/stream