mirror of
https://github.com/foomo/contentserver.git
synced 2025-10-16 12:25:44 +00:00
fix: add update log queue rejection
This commit is contained in:
parent
620291db4a
commit
934b1dc9c4
@ -223,7 +223,7 @@ func (repo *Repo) tryUpdate() (repoRuntime int64, err error) {
|
||||
return ur.repoRuntime, ur.err
|
||||
default:
|
||||
Log.Info("update request accepted, will be processed after the previous update")
|
||||
return 0, nil
|
||||
return 0, errUpdateRejected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
10
repo/repo.go
10
repo/repo.go
@ -255,13 +255,15 @@ func (repo *Repo) Update() (updateResponse *responses.Update) {
|
||||
updateResponse.Success = false
|
||||
updateResponse.Stats.NumberOfNodes = -1
|
||||
updateResponse.Stats.NumberOfURIs = -1
|
||||
// let us try to restore the world from a file
|
||||
Log.Error("could not update repository:", zap.Error(updateErr))
|
||||
// Log.Info(ansi.Yellow + "BUFFER LENGTH AFTER ERROR: " + strconv.Itoa(len(repo.jsonBuf.Bytes())) + ansi.Reset)
|
||||
updateResponse.ErrorMessage = updateErr.Error()
|
||||
|
||||
// let us try to restore the world from a file
|
||||
// Log.Info(ansi.Yellow + "BUFFER LENGTH AFTER ERROR: " + strconv.Itoa(len(repo.jsonBuf.Bytes())) + ansi.Reset)
|
||||
// only try to restore if the update failed during processing
|
||||
|
||||
if updateErr != errUpdateRejected {
|
||||
updateResponse.ErrorMessage = updateErr.Error()
|
||||
Log.Error("could not update repository:", zap.Error(updateErr))
|
||||
|
||||
restoreErr := repo.tryToRestoreCurrent()
|
||||
if restoreErr != nil {
|
||||
Log.Error("failed to restore preceding repo version", zap.Error(restoreErr))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user