Skip to content

Commit

Permalink
Edit name of server err chanel
Browse files Browse the repository at this point in the history
  • Loading branch information
divyaac committed Mar 18, 2024
1 parent 8d2fd9b commit 97201ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions manager/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions watch/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 97201ef

Please sign in to comment.