The original settings has less tolerance and would fail on some
environments.
package models
import (
+ "fmt"
+ "time"
+
"gopkg.in/testfixtures.v2"
)
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
}