util/eventbus: remove redundant code from eventbus.Publish
eventbus.Publish() calls newPublisher(), which in turn invokes (*Client).addPublisher(). That method adds the new publisher to c.pub, so we don’t need to add it again in eventbus.Publish. Updates #cleanup Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
@@ -21,11 +21,7 @@ type Publisher[T any] struct {
|
||||
}
|
||||
|
||||
func newPublisher[T any](c *Client) *Publisher[T] {
|
||||
ret := &Publisher[T]{
|
||||
client: c,
|
||||
}
|
||||
c.addPublisher(ret)
|
||||
return ret
|
||||
return &Publisher[T]{client: c}
|
||||
}
|
||||
|
||||
// Close closes the publisher.
|
||||
|
||||
Reference in New Issue
Block a user