Sink pool cleanup and organization; better future support when we add more sinks
This commit is contained in:
@@ -91,8 +91,8 @@ func (h *Handler) listenForServerEvents(ctx context.Context) error {
|
||||
logOutput := make(chan []byte)
|
||||
installOutput := make(chan []byte)
|
||||
h.server.Events().On(eventChan, e...)
|
||||
h.server.LogSink().On(logOutput)
|
||||
h.server.InstallSink().On(installOutput)
|
||||
h.server.Sink(server.LogSink).On(logOutput)
|
||||
h.server.Sink(server.InstallSink).On(installOutput)
|
||||
|
||||
onError := func(evt string, err2 error) {
|
||||
h.Logger().WithField("event", evt).WithField("error", err2).Error("failed to send event over server websocket")
|
||||
@@ -148,8 +148,8 @@ func (h *Handler) listenForServerEvents(ctx context.Context) error {
|
||||
|
||||
// These functions will automatically close the channel if it hasn't been already.
|
||||
h.server.Events().Off(eventChan, e...)
|
||||
h.server.LogSink().Off(logOutput)
|
||||
h.server.InstallSink().Off(installOutput)
|
||||
h.server.Sink(server.LogSink).Off(logOutput)
|
||||
h.server.Sink(server.InstallSink).Off(installOutput)
|
||||
|
||||
// If the internal context is stopped it is either because the parent context
|
||||
// got canceled or because we ran into an error. If the "err" variable is nil
|
||||
|
||||
Reference in New Issue
Block a user