mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
WAL watcher: improve comments
Clarify in the first comment that it is `watch()` that waits, and reduce verbiage. The second comment was slightly contradictory to the first and otherwise didn't seem to add much, since `currentSegment` was incremented just a few lines later. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
a975a83079
commit
6ed56c9f04
|
@ -290,8 +290,8 @@ func (w *Watcher) Run() error {
|
|||
for !isClosed(w.quit) {
|
||||
w.currentSegmentMetric.Set(float64(currentSegment))
|
||||
|
||||
// Reset the value of lastSegment each iteration, this is to avoid having to wait too long for
|
||||
// between reads if we're reading a segment that is not the most recent segment after startup.
|
||||
// Re-check on each iteration in case a new segment was added,
|
||||
// because watch() will wait for notifications on the last segment.
|
||||
_, lastSegment, err := w.firstAndLast()
|
||||
if err != nil {
|
||||
return fmt.Errorf("wal.Segments: %w", err)
|
||||
|
@ -299,8 +299,6 @@ func (w *Watcher) Run() error {
|
|||
tail := currentSegment >= lastSegment
|
||||
|
||||
level.Debug(w.logger).Log("msg", "Processing segment", "currentSegment", currentSegment, "lastSegment", lastSegment)
|
||||
// On start, after reading the existing WAL for series records, we have a pointer to what is the latest segment.
|
||||
// On subsequent calls to this function, currentSegment will have been incremented and we should open that segment.
|
||||
if err := w.watch(currentSegment, tail); err != nil && !errors.Is(err, ErrIgnorable) {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue