Skip to content

Commit 9458880

Browse files
typelessjonasfranz
authored andcommitted
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.
1 parent 43f9233 commit 9458880

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

models/test_fixtures.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
package models
66

77
import (
8+
"fmt"
9+
"time"
10+
811
"gopkg.in/testfixtures.v2"
912
)
1013

@@ -21,12 +24,16 @@ func InitFixtures(helper testfixtures.Helper, dir string) (err error) {
2124
func LoadFixtures() error {
2225
var err error
2326
// Database transaction conflicts could occur and result in ROLLBACK
24-
// As a simple workaround, we just retry 5 times.
25-
for i := 0; i < 5; i++ {
27+
// As a simple workaround, we just retry 20 times.
28+
for i := 0; i < 20; i++ {
2629
err = fixtures.Load()
2730
if err == nil {
2831
break
2932
}
33+
time.Sleep(200 * time.Millisecond)
34+
}
35+
if err != nil {
36+
fmt.Printf("LoadFixtures failed after retries: %v\n", err)
3037
}
3138
return err
3239
}

0 commit comments

Comments
 (0)