wenfengwang commented on a change in pull request #97: fix remote timeout unit
and add shutdown method
URL: https://github.com/apache/rocketmq-client-go/pull/97#discussion_r301385171
##########
File path: internal/kernel/client.go
##########
@@ -125,44 +129,64 @@ func (c *RMQClient) Start() {
// delay
time.Sleep(50 * time.Millisecond)
for {
- c.UpdateTopicRouteInfo()
- time.Sleep(_PullNameServerInterval)
+ if c.state {
+ c.UpdateTopicRouteInfo()
+ time.Sleep(_PullNameServerInterval)
+ } else {
+ return
+ }
}
}()
// TODO cleanOfflineBroker & sendHeartbeatToAllBrokerWithLock
go func() {
for {
- cleanOfflineBroker()
- c.SendHeartbeatToAllBrokerWithLock()
- time.Sleep(_HeartbeatBrokerInterval)
+ if c.state {
+ cleanOfflineBroker()
+ c.SendHeartbeatToAllBrokerWithLock()
+ time.Sleep(_HeartbeatBrokerInterval)
+ } else {
+ return
+ }
+
}
}()
// schedule persist offset
go func() {
//time.Sleep(10 * time.Second)
for {
Review comment:
> below is better?
>
> ```
> for !c.close {
> c.UpdateTopicRouteInfo()
> time.Sleep(_PullNameServerInterval)
> }
> ```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services