Skip to content

Commit

Permalink
Merge branch 'main' into pkg-stanza-singleton-metadatas
Browse files Browse the repository at this point in the history
  • Loading branch information
djaglowski committed Oct 24, 2023
2 parents be9ffed + 7daa7a3 commit dd70dc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/stanza/fileconsumer/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ func (m *Manager) archivePreviousFiles(ctx context.Context) {
for _, r := range m.previousPollFiles {
m.knownFiles = append(m.knownFiles, r.Close())
}
if m.persister == nil {
return
}
if err := checkpoint.Save(ctx, m.persister, m.knownFiles); err != nil {
m.Errorw("save offsets", zap.Error(err))
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/stanza/fileconsumer/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func buildTestManager(t *testing.T, cfg *Config, opts ...testManagerOption) (*Ma
}
input, err := cfg.Build(testutil.Logger(t), testEmitFunc(tmc.emitChan))
require.NoError(t, err)
t.Cleanup(func() {
input.archivePreviousFiles(context.Background())
})
return input, tmc.emitChan
}

Expand Down

0 comments on commit dd70dc5

Please sign in to comment.