Skip to content

Commit 29874d6

Browse files
committed
Update
1 parent 7a9ff9d commit 29874d6

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

beat.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,36 @@ import (
1010
)
1111

1212
type BeatReactor struct {
13-
config *Config
14-
beatMap ConcurrentMap
15-
clientBeatInterval int64
16-
beatThreadCount int
17-
beatThreadSemaphore *semaphore.Weighted
18-
beatRecordMap ConcurrentMap
19-
mux *sync.Mutex
20-
log Logger
21-
Period time.Duration
13+
config *Config
14+
beatMap ConcurrentMap
15+
clientBeatIntervalInSecs int64
16+
beatThreadCount int
17+
beatThreadSemaphore *semaphore.Weighted
18+
beatRecordMap ConcurrentMap
19+
mux *sync.Mutex
20+
log Logger
21+
Period time.Duration
2222
}
2323

2424
const DefaultBeatThreadNum = 20
2525

2626
var ctx = context.Background()
2727

28-
func NewBeatReactor(config *Config, clientBeatInterval int64) BeatReactor {
28+
func NewBeatReactor(config *Config, clientBeatIntervalInSecs int64) BeatReactor {
2929
br := BeatReactor{
3030
config: config,
3131
}
32-
if clientBeatInterval <= 0 {
33-
clientBeatInterval = 5 * 1000
32+
if clientBeatIntervalInSecs <= 0 {
33+
clientBeatIntervalInSecs = 5
3434
}
3535
br.beatMap = NewConcurrentMap()
36-
br.clientBeatInterval = clientBeatInterval
36+
br.clientBeatIntervalInSecs = clientBeatIntervalInSecs
3737
br.beatThreadCount = DefaultBeatThreadNum
3838
br.beatRecordMap = NewConcurrentMap()
3939
br.beatThreadSemaphore = semaphore.NewWeighted(int64(br.beatThreadCount))
4040
br.mux = new(sync.Mutex)
4141
br.log = NewLogger()
42-
br.Period = time.Duration(time.Millisecond.Milliseconds() * clientBeatInterval)
42+
br.Period = time.Duration(clientBeatIntervalInSecs) * time.Second
4343
return br
4444
}
4545

client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (c *Client) doRegister() error {
101101
}
102102

103103
func (c *Client) doUnRegister() error {
104-
return UnRegister(c.Config.DefaultZone, c.Instance.App, c.Instance.InstanceID)
104+
return UnRegister(c.Config.DefaultZone, c.Instance.App, c.Instance)
105105
}
106106

107107
func (c *Client) doHeartbeat() error {

0 commit comments

Comments
 (0)