@@ -10,36 +10,36 @@ import (
1010)
1111
1212type 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
2424const DefaultBeatThreadNum = 20
2525
2626var 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
0 commit comments