mirror of
https://github.com/prometheus/prometheus.git
synced 2026-02-03 20:39:32 -05:00
refactor: watcher code cleanup
Signed-off-by: Adam Bernot <bernot@google.com>
This commit is contained in:
parent
954cad35b2
commit
c765bf222e
2 changed files with 5 additions and 5 deletions
|
|
@ -293,11 +293,11 @@ func (w *Watcher) Run() error {
|
|||
|
||||
// Backfill from the checkpoint first if it exists.
|
||||
lastCheckpoint, checkpointIndex, err := LastCheckpoint(w.walDir)
|
||||
if err != nil && !errors.Is(err, record.ErrNotFound) {
|
||||
switch {
|
||||
case errors.Is(err, record.ErrNotFound): // Noop
|
||||
case err != nil:
|
||||
return fmt.Errorf("tsdb.LastCheckpoint: %w", err)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
default:
|
||||
if err = w.readCheckpoint(lastCheckpoint, (*Watcher).readSegment); err != nil {
|
||||
return fmt.Errorf("readCheckpoint: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -873,7 +873,7 @@ func (w *WL) Close() (err error) {
|
|||
}
|
||||
|
||||
// Segments returns the range [first, n] of currently existing segments.
|
||||
// If no segments are found, first and n are -1.
|
||||
// If no segments are found, first and last are -1.
|
||||
func Segments(wlDir string) (first, last int, err error) {
|
||||
refs, err := listSegments(wlDir)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue