mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 03:37:46 +08:00
update sleep time
This commit is contained in:
parent
07260308af
commit
6c84e5250e
6
db/db.go
6
db/db.go
@ -145,16 +145,14 @@ func CreateManager(config config.Config) (err error) {
|
||||
return fmt.Errorf("DB drivers: %s not supported", config.DBType)
|
||||
}
|
||||
|
||||
var tryTime time.Duration
|
||||
for {
|
||||
tryTime++
|
||||
defaultManager, err = mysql.CreateManager(config)
|
||||
if err == nil {
|
||||
logrus.Infof("db manager is ready")
|
||||
break
|
||||
}
|
||||
logrus.Errorf("get db manager failed, try time is %v,%s", tryTime, err.Error())
|
||||
time.Sleep((5 + tryTime*10) * time.Second)
|
||||
logrus.Errorf("get db manager failed, try time is %d,%s", 10, err.Error())
|
||||
time.Sleep(10 * time.Second)
|
||||
}
|
||||
//TODO:etcd db plugin
|
||||
//defaultManager, err = etcd.CreateManager(config)
|
||||
|
@ -115,19 +115,16 @@ func NewClient(ctx context.Context, clientArgs *ClientArgs) (*v3.Client, error)
|
||||
}
|
||||
config.TLS = tlsConfig
|
||||
}
|
||||
var tryTime time.Duration
|
||||
tryTime = 0
|
||||
var etcdClient *v3.Client
|
||||
var err error
|
||||
for {
|
||||
tryTime++
|
||||
etcdClient, err = clientv3.New(config)
|
||||
if err == nil {
|
||||
logrus.Infof("etcd.v3 client is ready")
|
||||
return etcdClient, nil
|
||||
}
|
||||
logrus.Errorf("create etcd.v3 client failed, try time is %v,%s", tryTime, err.Error())
|
||||
time.Sleep((5 + tryTime*10) * time.Second)
|
||||
logrus.Errorf("create etcd.v3 client failed, try time is %d,%s", 10, err.Error())
|
||||
time.Sleep(10 * time.Second)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user