Skip to content

Commit

Permalink
Add setReader() function
Browse files Browse the repository at this point in the history
  • Loading branch information
paul1r committed Apr 18, 2024
1 parent 792004a commit f932a31
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions clients/pkg/promtail/targets/file/filetarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,7 @@ func (t *FileTarget) startTailing(ps []string) {
}
reader = tailer
}
t.readersMutex.Lock()
t.readers[p] = reader
t.readersMutex.Unlock()
t.setReader(p, reader)
}
}

Expand Down Expand Up @@ -452,6 +450,12 @@ func (t *FileTarget) getReader(val string) (Reader, bool) {
return reader, ok
}

func (t *FileTarget) setReader(val string, reader Reader) {
t.readersMutex.Lock()
defer t.readersMutex.Unlock()
t.readers[val] = reader
}

func (t *FileTarget) getWatch(val string) (struct{}, bool) {
t.watchesMutex.Lock()
defer t.watchesMutex.Unlock()
Expand Down

0 comments on commit f932a31

Please sign in to comment.