@@ -13,10 +13,11 @@ import (
13
13
var (
14
14
client * local.Client
15
15
LocalEvaluationConfigDebug = true
16
- LocalEvaluationConfigServerUrl = "https://api .lambdatest.com"
16
+ LocalEvaluationConfigServerUrl = "https://apii .lambdatest.com"
17
17
LocalEvaluationConfigPollInterval = 120
18
18
LocalEvaluationConfigPollerRequestTimeout = 60
19
19
LocalEvaluationDeploymentKey = "server-jAqqJaX3l8PgNiJpcv9j20ywPzANQQFh"
20
+ retries = 5
20
21
)
21
22
22
23
type Variant struct {
@@ -73,7 +74,16 @@ func Initialize() {
73
74
FlagConfigPollerRequestTimeout : time .Duration (LocalEvaluationConfigPollerRequestTimeout ) * time .Second ,
74
75
}
75
76
client = local .Initialize (LocalEvaluationDeploymentKey , & config )
76
- err := client .Start ()
77
+ var err error
78
+ for i := 0 ; i < retries ; i ++ {
79
+ err = client .Start ()
80
+ if err != nil {
81
+ err = fmt .Errorf ("unable to create local evaluation client with given config %+v attempt:%v with error %s" , config , i + 1 , err .Error ())
82
+ continue
83
+ } else {
84
+ break
85
+ }
86
+ }
77
87
if err != nil {
78
88
err = fmt .Errorf ("unable to create local evaluation client with given config %+v with error %s" , config , err .Error ())
79
89
panic (err )
@@ -82,7 +92,16 @@ func Initialize() {
82
92
83
93
func InitializeWithConfig (conf local.Config , deploymentKey string ) {
84
94
client = local .Initialize (deploymentKey , & conf )
85
- err := client .Start ()
95
+ var err error
96
+ for i := 0 ; i < retries ; i ++ {
97
+ err = client .Start ()
98
+ if err != nil {
99
+ err = fmt .Errorf ("unable to create local evaluation client with given config %+v attempt:%v with error %s" , conf , i + 1 , err .Error ())
100
+ continue
101
+ } else {
102
+ break
103
+ }
104
+ }
86
105
if err != nil {
87
106
err = fmt .Errorf ("unable to create local evaluation client with given config %+v with error %s" , conf , err .Error ())
88
107
panic (err )
0 commit comments