Skip to content

Commit

Permalink
fix: when found duplicate, continue from outer loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Vihas Splunk committed Nov 4, 2023
1 parent 3d94380 commit 0e7ea3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/stanza/fileconsumer/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func (m *Manager) makeFingerprint(path string) (*fingerprint.Fingerprint, *os.Fi
// been read this polling interval
func (m *Manager) makeReaders(paths []string) []*reader.Reader {
readers := make([]*reader.Reader, 0, len(paths))
OUTER:
for _, path := range paths {
fp, file := m.makeFingerprint(path)
if fp == nil {
Expand All @@ -210,7 +211,7 @@ func (m *Manager) makeReaders(paths []string) []*reader.Reader {
if err := file.Close(); err != nil {
m.Debugw("problem closing file", zap.Error(err))
}
continue
continue OUTER
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/stanza/fileconsumer/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,7 @@ func TestStalePartialFingerprintDiscarded(t *testing.T) {
waitForToken(t, emitCalls, []byte(content))
expectNoTokens(t, emitCalls)
operator.wg.Wait()
require.Len(t, operator.previousPollFiles, 1)

// keep append data to file1 and file2
newContent := "bbbbbbbbbbbb"
Expand Down

0 comments on commit 0e7ea3d

Please sign in to comment.