equanz commented on a change in pull request #581:
URL: https://github.com/apache/pulsar-client-go/pull/581#discussion_r685692859



##########
File path: pulsar/internal/service_name_resolver.go
##########
@@ -98,8 +106,9 @@ func (r *pulsarServiceNameResolver) UpdateServiceURL(u 
*url.URL) error {
        r.AddressList = addresses
        r.ServiceURL = u
        r.ServiceURI = uri
-       rand.Seed(time.Now().Unix()) // initialize global pseudo random 
generator
-       atomic.StoreInt32(&r.CurrentIndex, int32(rand.Intn(len(addresses))))
+       r.mutex.Lock()

Review comment:
       In this PR, I only mentioned `CurrentIndex`. However I think your 
comment is correct, so I'll address your comment.
   

##########
File path: pulsar/internal/service_name_resolver.go
##########
@@ -42,6 +42,12 @@ type pulsarServiceNameResolver struct {
        ServiceURL   *url.URL
        CurrentIndex int32
        AddressList  []*url.URL

Review comment:
       > Not sure why all these are public
   
   I think so too.
   I won't change the visibility in this PR, but we might want to do so.
   




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to