mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-10-17 12:15:37 +02:00
Retry DB transactions on badger.ErrConflict (#114)
* Log HTTP 500 errors in more detail * Log errors in storeView and storeUpdate * Retry on badger.ErrConflict
This commit is contained in:
@@ -16,7 +16,8 @@ func (controller *Controller) getClusterSettings(ctx *gin.Context) responder.Res
|
||||
return controller.storeView(func(txn storepkg.Transaction) responder.Responder {
|
||||
clusterSettings, err := txn.GetClusterSettings()
|
||||
if err != nil {
|
||||
controller.logger.Errorf("failed to retrieve cluster settings: %v", err)
|
||||
controller.logger.Errorf("failed to retrieve cluster settings from the DB: %v", err)
|
||||
|
||||
return responder.Code(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
@@ -45,6 +46,8 @@ func (controller *Controller) updateClusterSettings(ctx *gin.Context) responder.
|
||||
|
||||
return controller.storeUpdate(func(txn storepkg.Transaction) responder.Responder {
|
||||
if err := txn.SetClusterSettings(clusterSettings); err != nil {
|
||||
controller.logger.Errorf("failed to set cluster settings in the DB: %v", err)
|
||||
|
||||
return responder.Code(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user