mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-24 10:07:21 +02:00
Postgress can exec Sync2 after migration only in own transactions (#544)
(postgress do not allow us to use sync2 twice in one transaction at all)
This commit is contained in:
parent
88236d8d59
commit
34a17f8219
@ -85,11 +85,11 @@ func Migrate(e *xorm.Engine) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := syncAll(sess); err != nil {
|
||||
if err := sess.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return sess.Commit()
|
||||
return syncAll(e)
|
||||
}
|
||||
|
||||
func runTasks(sess *xorm.Session, tasks []task) error {
|
||||
@ -128,7 +128,11 @@ func runTasks(sess *xorm.Session, tasks []task) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func syncAll(sess *xorm.Session) error {
|
||||
type syncEngine interface {
|
||||
Sync2(beans ...interface{}) error
|
||||
}
|
||||
|
||||
func syncAll(sess syncEngine) error {
|
||||
for _, bean := range []interface{}{
|
||||
new(model.Agent),
|
||||
new(model.Build),
|
||||
|
Loading…
Reference in New Issue
Block a user