Skip to content

Commit 475201a

Browse files
authored
fix add beat info (#557)
1 parent ea56886 commit 475201a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Diff for: clients/naming_client/beat_reactor.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ func (br *BeatReactor) AddBeatInfo(serviceName string, beatInfo *model.BeatInfo)
7070
defer br.mux.Unlock()
7171
br.mux.Lock()
7272
if data, ok := br.beatMap.Get(k); ok {
73-
beatInfo = data.(*model.BeatInfo)
74-
atomic.StoreInt32(&beatInfo.State, int32(model.StateShutdown))
73+
oldBeatInfo := data.(*model.BeatInfo)
74+
atomic.StoreInt32(&oldBeatInfo.State, int32(model.StateShutdown))
7575
br.beatMap.Remove(k)
7676
}
7777
br.beatMap.Set(k, beatInfo)
@@ -111,8 +111,7 @@ func (br *BeatReactor) sendInstanceBeat(k string, beatInfo *model.BeatInfo) {
111111
if err != nil {
112112
logger.Errorf("beat to server return error:%+v", err)
113113
br.beatThreadSemaphore.Release(1)
114-
t := time.NewTimer(beatInfo.Period)
115-
<-t.C
114+
time.Sleep(beatInfo.Period)
116115
continue
117116
}
118117
if beatInterval > 0 {
@@ -122,7 +121,6 @@ func (br *BeatReactor) sendInstanceBeat(k string, beatInfo *model.BeatInfo) {
122121
br.beatRecordMap.Set(k, util.CurrentMillis())
123122
br.beatThreadSemaphore.Release(1)
124123

125-
t := time.NewTimer(beatInfo.Period)
126-
<-t.C
124+
time.Sleep(beatInfo.Period)
127125
}
128126
}

Diff for: common/constant/const.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const (
6666
KEY_BEAT = "beat"
6767
KEY_DOM = "dom"
6868
DEFAULT_CONTEXT_PATH = "/nacos"
69-
CLIENT_VERSION = "Nacos-Go-Client:v1.0.1"
69+
CLIENT_VERSION = "Nacos-Go-Client:v1.1.4"
7070
REQUEST_DOMAIN_RETRY_TIME = 3
7171
SERVICE_INFO_SPLITER = "@@"
7272
CONFIG_INFO_SPLITER = "@@"

0 commit comments

Comments
 (0)