refactor: watcher code cleanup

Signed-off-by: Adam Bernot <bernot@google.com>
This commit is contained in:
Adam Bernot 2025-08-27 18:00:25 +00:00
parent 954cad35b2
commit c765bf222e
No known key found for this signature in database
GPG key ID: 161B8FFD23B23A81
2 changed files with 5 additions and 5 deletions

View file

@ -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)
}

View file

@ -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 {