AsperforMias commented on code in PR #3479:
URL: https://github.com/apache/dubbo-go/pull/3479#discussion_r3536525620


##########
registry/nacos/registry.go:
##########
@@ -375,9 +386,42 @@ func (nr *nacosRegistry) LoadSubscribeInstances(url 
*common.URL, notify registry
        return nil
 }
 
+func (nr *nacosRegistry) storeInitialSubscribeInstances(serviceName string, 
groupName string, instances []model.Instance) {
+       if len(instances) == 0 {
+               return
+       }
+       copied := make([]model.Instance, len(instances))
+       copy(copied, instances)
+       nr.initialSubscribeInstances.Store(subscribeCacheKey(serviceName, 
groupName), copied)
+}
+
+func (nr *nacosRegistry) loadInitialSubscribeInstances(serviceName string, 
groupName string) ([]model.Instance, bool) {
+       value, ok := 
nr.initialSubscribeInstances.Load(subscribeCacheKey(serviceName, groupName))
+       if !ok {
+               return nil, false
+       }
+       instances, ok := value.([]model.Instance)
+       return instances, ok
+}
+
+func (nr *nacosRegistry) deleteInitialSubscribeInstances(serviceName string, 
groupName string) {
+       nr.initialSubscribeInstances.Delete(subscribeCacheKey(serviceName, 
groupName))
+}
+
+func (nr *nacosRegistry) clearInitialSubscribeInstances() {
+       nr.initialSubscribeInstances.Range(func(key any, _ any) bool {
+               nr.initialSubscribeInstances.Delete(key)
+               return true
+       })
+}

Review Comment:
   done in new commit



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to