Skip to content

Sharing one PublicRandStream per chain between next callers - #31

Merged
AnomalRoil merged 5 commits into
masterfrom
fix-shared-next-stream
Nov 11, 2026
Merged

AnomalRoil merged 5 commits into
masterfrom
fix-shared-next-stream

Conversation

@AnomalRoil

Copy link
Copy Markdown
Member

The node keys its streams by peer address, so each next request opening its own stream over our shared conn was evicting the previous caller's one, which then got a 500. We now keep a single stream per chain in the Client and fan out its beacons to all the waiting Next callers.

Also, a stream that stays silent for two periods gets reopened, alternating SkipCtxKey so we move off a node that stopped emitting, without failing the callers waiting on it. Notice it only alternates between the two preferred nodes, a third one is never reached since that's how the picker works.

Fixes drand/drand-infra#240

The node keys its streams by peer address, so each Next call opening its
own stream evicted the previous caller's one.
A stream that stays silent for two periods is cancelled, so the next
caller reopens it through the picker.
Reopens after a failure alternate SkipCtxKey so the picker leaves the node
that failed. A stall reopens the stream without failing the callers waiting
on it.
@AnomalRoil
AnomalRoil merged commit 1a2a5c0 into master Nov 11, 2026
3 of 4 checks passed
@AnomalRoil
AnomalRoil deleted the fix-shared-next-stream branch November 11, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant