From 97201efc11ac8ac9ff9ca63382bad7a05a9e9191 Mon Sep 17 00:00:00 2001 From: divyaac Date: Mon, 18 Mar 2024 12:14:24 -0700 Subject: [PATCH] Edit name of server err chanel --- manager/runner.go | 12 ++++++------ watch/watcher.go | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/manager/runner.go b/manager/runner.go index 4a318d8dc..102fb8c9b 100644 --- a/manager/runner.go +++ b/manager/runner.go @@ -38,9 +38,9 @@ type Runner struct { ErrCh chan error DoneCh chan struct{} - // ServerCh is a channel to surface error responses from the server up the calling stack + // ServerErrCh is a channel to surface error responses from the server up the calling stack // and will only hold a maximum of one error at a time - ServerCh chan error + ServerErrCh chan error // config is the Config that created this Runner. It is used internally to // construct other objects and pass data. @@ -203,7 +203,7 @@ func NewRunner(config *config.Config, dry bool) (*Runner, error) { runner := &Runner{ ErrCh: make(chan error), DoneCh: make(chan struct{}), - ServerCh: make(chan error), + ServerErrCh: make(chan error), config: config, dry: dry, inStream: os.Stdin, @@ -439,16 +439,16 @@ func (r *Runner) Start() { log.Printf("[ERR] (runner) watcher reported error: %s", err) r.ErrCh <- err return - case err := <-r.watcher.ServerCh(): + case err := <-r.watcher.ServerErrCh(): // If we got a server error we push the error up the stack log.Printf("[ERR] (runner) sending server error back to caller") // Drain the error channel if anything already exists select { - case <-r.ServerCh: + case <-r.ServerErrCh: continue default: } - r.ServerCh <- err + r.ServerErrCh <- err goto OUTER case err := <-r.vaultTokenWatcher.ErrCh(): // Push the error back up the stack diff --git a/watch/watcher.go b/watch/watcher.go index b0c4ea9f0..571e43fcf 100644 --- a/watch/watcher.go +++ b/watch/watcher.go @@ -30,8 +30,8 @@ type Watcher struct { // errCh is the chan where any errors will be published. errCh chan error - // serverCh is the chan where response errors from the server will be published - serverCh chan error + // serverErrCh is the chan where response errors from the server will be published + serverErrCh chan error // blockQueryWaitTime is amount of time in seconds to do a blocking query for blockQueryWaitTime time.Duration @@ -98,7 +98,7 @@ func NewWatcher(i *NewWatcherInput) *Watcher { depViewMap: make(map[string]*View), dataCh: make(chan *View, dataBufferSize), errCh: make(chan error), - serverCh: make(chan error), + serverErrCh: make(chan error), maxStale: i.MaxStale, once: i.Once, blockQueryWaitTime: i.BlockQueryWaitTime, @@ -125,13 +125,13 @@ func (w *Watcher) ErrCh() <-chan error { return w.errCh } -// ServerCh returns a read-only channel of errors returned by the server +// ServerErrCh returns a read-only channel of errors returned by the server // as a response to each consul-template instance -func (w *Watcher) ServerCh() <-chan error { +func (w *Watcher) ServerErrCh() <-chan error { if w == nil { return nil } - return w.serverCh + return w.serverErrCh } // Add adds the given dependency to the list of monitored dependencies @@ -182,7 +182,7 @@ func (w *Watcher) Add(d dep.Dependency) (bool, error) { log.Printf("[TRACE] (watcher) %s starting", d) w.depViewMap[d.String()] = v - go v.poll(w.dataCh, w.errCh, w.serverCh) + go v.poll(w.dataCh, w.errCh, w.serverErrCh) return true, nil }