Skip to content

Commit

Permalink
events/broadcaster Buffer val when writing to subscriber channel (#111)
Browse files Browse the repository at this point in the history
Signed-off-by: joshvanl <[email protected]>
  • Loading branch information
JoshVanL authored Jan 10, 2025
1 parent 65ba378 commit fb19570
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion events/broadcaster/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ func (b *Broadcaster[T]) subscribe(ctx context.Context, ch chan<- T) {
return
case <-b.closeCh:
return
case ch <- <-bufferedCh:
case val := <-bufferedCh:
select {
case <-ctx.Done():
return
case <-b.closeCh:
return
case ch <- val:
}
}
}
}()
Expand Down

0 comments on commit fb19570

Please sign in to comment.