|
|
@ -83,9 +83,9 @@ func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName strin
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case pv, ok := <-kresp:
|
|
|
|
case pv, ok := <-kresp:
|
|
|
|
if ok == true {
|
|
|
|
if ok == true {
|
|
|
|
log.Debug(operationID, "KeepAlive kresp ok", pv)
|
|
|
|
log.Debug(operationID, "KeepAlive kresp ok", pv, args)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.Error(operationID, "KeepAlive kresp failed", pv)
|
|
|
|
log.Error(operationID, "KeepAlive kresp failed ", pv, args)
|
|
|
|
t := time.NewTicker(time.Duration(ttl/2) * time.Second)
|
|
|
|
t := time.NewTicker(time.Duration(ttl/2) * time.Second)
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
@ -94,7 +94,7 @@ func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName strin
|
|
|
|
ctx, _ := context.WithCancel(context.Background())
|
|
|
|
ctx, _ := context.WithCancel(context.Background())
|
|
|
|
resp, err := cli.Grant(ctx, int64(ttl))
|
|
|
|
resp, err := cli.Grant(ctx, int64(ttl))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.Error(operationID, "Grant failed ", err.Error())
|
|
|
|
log.Error(operationID, "Grant failed ", err.Error(), args)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|