()
| 279 | } |
| 280 | |
| 281 | func (w *Watcher) loop() { |
| 282 | defer close(w.done) |
| 283 | |
| 284 | // We may encounter failures processing the WAL; we should wait and retry. |
| 285 | for !isClosed(w.quit) { |
| 286 | w.SetStartTime(time.Now()) |
| 287 | if err := w.Run(); err != nil { |
| 288 | w.logger.Error("error tailing WAL", "err", err) |
| 289 | } |
| 290 | |
| 291 | select { |
| 292 | case <-w.quit: |
| 293 | return |
| 294 | case <-time.After(5 * time.Second): |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | // Run the watcher, which will tail the WAL until the quit channel is closed |
| 300 | // or an error case is hit. |
no test coverage detected