mirror of
https://github.com/foomo/contentserver.git
synced 2025-10-16 12:25:44 +00:00
Merge pull request #52 from foomo/fix/get-repo-returns-stale-results
fix: update before getRepo
This commit is contained in:
commit
e7e5d09f50
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user