summaryrefslogtreecommitdiffstats
path: root/models/test_fixtures.go
diff options
context:
space:
mode:
authorMura Li <typeless@users.noreply.github.com>2018-10-21 22:09:17 +0800
committerJonas Franz <info@jonasfranz.software>2018-10-21 16:09:17 +0200
commit9458880c068c985692a49caf608f0057c73790bf (patch)
tree666899b3e1d46c732195760bba7dad267efdaf85 /models/test_fixtures.go
parent43f92339146224872383d2507ac9487f4857536b (diff)
downloadgitea-9458880c068c985692a49caf608f0057c73790bf.tar.gz
gitea-9458880c068c985692a49caf608f0057c73790bf.zip
Increase the retry limit to 20 times and the interval to 200ms (#5134)
The original settings has less tolerance and would fail on some environments.
Diffstat (limited to 'models/test_fixtures.go')
-rw-r--r--models/test_fixtures.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/models/test_fixtures.go b/models/test_fixtures.go
index 2a70bc9816..8ef9e1af90 100644
--- a/models/test_fixtures.go
+++ b/models/test_fixtures.go
@@ -5,6 +5,9 @@
package models
import (
+ "fmt"
+ "time"
+
"gopkg.in/testfixtures.v2"
)
@@ -21,12 +24,16 @@ func InitFixtures(helper testfixtures.Helper, dir string) (err error) {
func LoadFixtures() error {
var err error
// Database transaction conflicts could occur and result in ROLLBACK
- // As a simple workaround, we just retry 5 times.
- for i := 0; i < 5; i++ {
+ // As a simple workaround, we just retry 20 times.
+ for i := 0; i < 20; i++ {
err = fixtures.Load()
if err == nil {
break
}
+ time.Sleep(200 * time.Millisecond)
+ }
+ if err != nil {
+ fmt.Printf("LoadFixtures failed after retries: %v\n", err)
}
return err
}