fix: add RollbackUnlessCommitted for gorm transactions (#7197)

This commit is contained in:
Stefan Benz
2024-01-11 00:02:50 +01:00
committed by GitHub
parent 7c592ce638
commit 3d3264eb8f
2 changed files with 4 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ func PrepareSearchQuery(table string, request SearchRequest) func(db *gorm.DB, r
if err := query.Commit().Error; err != nil {
logging.OnError(err).Info("commit failed")
}
query.RollbackUnlessCommitted()
}()
query = query.Count(&count)