Skip to content

Commit

Permalink
fix add beat info (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
binbin0325 authored Jan 12, 2023
1 parent ea56886 commit 475201a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions clients/naming_client/beat_reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func (br *BeatReactor) AddBeatInfo(serviceName string, beatInfo *model.BeatInfo)
defer br.mux.Unlock()
br.mux.Lock()
if data, ok := br.beatMap.Get(k); ok {
beatInfo = data.(*model.BeatInfo)
atomic.StoreInt32(&beatInfo.State, int32(model.StateShutdown))
oldBeatInfo := data.(*model.BeatInfo)
atomic.StoreInt32(&oldBeatInfo.State, int32(model.StateShutdown))
br.beatMap.Remove(k)
}
br.beatMap.Set(k, beatInfo)
Expand Down Expand Up @@ -111,8 +111,7 @@ func (br *BeatReactor) sendInstanceBeat(k string, beatInfo *model.BeatInfo) {
if err != nil {
logger.Errorf("beat to server return error:%+v", err)
br.beatThreadSemaphore.Release(1)
t := time.NewTimer(beatInfo.Period)
<-t.C
time.Sleep(beatInfo.Period)
continue
}
if beatInterval > 0 {
Expand All @@ -122,7 +121,6 @@ func (br *BeatReactor) sendInstanceBeat(k string, beatInfo *model.BeatInfo) {
br.beatRecordMap.Set(k, util.CurrentMillis())
br.beatThreadSemaphore.Release(1)

t := time.NewTimer(beatInfo.Period)
<-t.C
time.Sleep(beatInfo.Period)
}
}
2 changes: 1 addition & 1 deletion common/constant/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const (
KEY_BEAT = "beat"
KEY_DOM = "dom"
DEFAULT_CONTEXT_PATH = "/nacos"
CLIENT_VERSION = "Nacos-Go-Client:v1.0.1"
CLIENT_VERSION = "Nacos-Go-Client:v1.1.4"
REQUEST_DOMAIN_RETRY_TIME = 3
SERVICE_INFO_SPLITER = "@@"
CONFIG_INFO_SPLITER = "@@"
Expand Down

0 comments on commit 475201a

Please sign in to comment.