feat app 模块化启动
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"common/db/etcd"
|
||||
"common/discover/common"
|
||||
"common/log"
|
||||
"context"
|
||||
"fmt"
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"strconv"
|
||||
@@ -42,7 +41,7 @@ func RegisterInstance(sid int64, instanceID int, uniqueNo, ttl int64) error {
|
||||
return err
|
||||
}
|
||||
key := fmt.Sprintf("%v/%v/%v", common.KeyDiscoverInstance, instanceID, uniqueNo)
|
||||
_, err = etcd.Client().Put(context.Background(), key, strconv.Itoa(int(sid)), clientv3.WithLease(leaseID))
|
||||
_, err = etcd.GetClient().Put(key, strconv.Itoa(int(sid)), clientv3.WithLease(leaseID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -55,7 +54,7 @@ func UnRegisterInstance(uniqueNo int64) {
|
||||
serverMU.Lock()
|
||||
defer serverMU.Unlock()
|
||||
if leaseID, ok := instanceLeaseM[uniqueNo]; ok {
|
||||
_, err := etcd.Client().Revoke(context.Background(), leaseID)
|
||||
_, err := etcd.GetClient().Revoke(leaseID)
|
||||
if err != nil {
|
||||
log.Errorf("UnRegisterInstance err: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user