File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 1- FROM docker/compose
1+ FROM docker/compose:1.25.1
22COPY pico /
33ENTRYPOINT ["/pico" ]
Original file line number Diff line number Diff line change @@ -113,15 +113,25 @@ func (p *GitProvider) watchConfig() (err error) {
113113 return errors .Wrap (err , "failed to watch config target" )
114114 }
115115
116+ errs := make (chan error )
116117 go func () {
117118 e := p .configWatcher .Run ()
118119 if e != nil && ! errors .Is (e , context .Canceled ) {
119- zap .L ().Error ("config watcher failed" , zap .Error (e ))
120+ errs <- e
121+ }
122+ // TODO: forward these errors elsewhere.
123+ for e = range p .configWatcher .Errors {
124+ zap .L ().Error ("config watcher error occurred" , zap .Error (e ))
120125 }
121126 }()
122127 zap .L ().Debug ("created new config watcher, awaiting setup" )
123128
124- <- p .configWatcher .InitialDone
129+ select {
130+ case <- p .configWatcher .InitialDone :
131+ case err = <- errs :
132+ }
133+
134+ zap .L ().Debug ("config watcher initialised" )
125135
126136 return
127137}
Original file line number Diff line number Diff line change @@ -192,15 +192,21 @@ func (w *GitWatcher) watchTargets() (err error) {
192192 return errors .Wrap (err , "failed to watch targets" )
193193 }
194194
195+ errs := make (chan error )
195196 go func () {
196197 e := w .targetsWatcher .Run ()
197198 if e != nil && ! errors .Is (e , context .Canceled ) {
198- w . errors <- e
199+ errs <- e
199200 }
201+ // forward errors from the watcher to the central for-select above
202+ w .errors <- <- w .targetsWatcher .Errors
200203 }()
201204 zap .L ().Debug ("created targets watcher, awaiting setup" )
202205
203- <- w .targetsWatcher .InitialDone
206+ select {
207+ case <- w .targetsWatcher .InitialDone :
208+ case err = <- errs :
209+ }
204210
205211 zap .L ().Debug ("targets watcher initialised" )
206212
You can’t perform that action at this time.
0 commit comments