diff --git a/pkg/repo/loader.go b/pkg/repo/loader.go index 6910545..010ec04 100644 --- a/pkg/repo/loader.go +++ b/pkg/repo/loader.go @@ -305,6 +305,15 @@ func (r *Repo) update(ctx context.Context) (repoRuntime int64, err error) { if r.poll { r.pollVersion = repoURL } + + // Persist the JSON buffer after successful update + if err := r.history.Add(r.JSONBufferBytes()); err != nil { + r.l.Error("Failed to persist repo after update", zap.Error(err)) + metrics.HistoryPersistFailedCounter.WithLabelValues().Inc() + } else { + r.l.Info("Successfully persisted repo after update") + } + return repoRuntime, nil } diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index 111218d..df8a0ff 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -285,6 +285,8 @@ func (r *Repo) Update() (updateResponse *responses.Update) { if historyErr != nil { r.l.Error("Could not persist current repo in history", zap.Error(historyErr)) metrics.HistoryPersistFailedCounter.WithLabelValues().Inc() + } else { + r.l.Info("Successfully persisted current repo to history") } // add some stats for _, dimension := range r.Directory() {