util/eventbus: add debug hooks to snoop on bus traffic

Updates #15160

Signed-off-by: David Anderson <dave@tailscale.com>
This commit is contained in:
David Anderson
2025-03-05 19:37:03 -08:00
committed by Dave Anderson
parent dd7166cb8e
commit e80d2b4ad1
4 changed files with 56 additions and 28 deletions

View File

@@ -5,15 +5,8 @@ package eventbus
import (
"reflect"
"time"
)
type publishedEvent struct {
Event any
From *Client
Published time.Time
}
// publisher is a uniformly typed wrapper around Publisher[T], so that
// debugging facilities can look at active publishers.
type publisher interface {
@@ -60,9 +53,8 @@ func (p *Publisher[T]) Publish(v T) {
}
evt := publishedEvent{
Event: v,
From: p.client,
Published: time.Now(),
Event: v,
From: p.client,
}
select {