Vanillaxi commented on code in PR #3482:
URL: https://github.com/apache/dubbo-go/pull/3482#discussion_r3607427309


##########
registry/polaris/registry.go:
##########
@@ -188,14 +225,91 @@ func (pr *polarisRegistry) LoadSubscribeInstances(url 
*common.URL, notify regist
                return perrors.New(fmt.Sprintf("could not query the instances 
for serviceName=%s,namespace=%s,error=%v",
                        serviceName, pr.namespace, err))
        }
+       initialSubscribeInstances := make([]model.Instance, 0, 
len(resp.Instances))
        for i := range resp.Instances {
                if newUrl := generateUrl(resp.Instances[i]); newUrl != nil {
                        notify.Notify(&registry.ServiceEvent{Action: 
remoting.EventTypeAdd, Service: newUrl})
+                       initialSubscribeInstances = 
append(initialSubscribeInstances, resp.Instances[i])
                }
        }
+       pr.storeInitialSubscribeInstances(key, initialSubscribeInstances)
        return nil
 }
 
+func newInitialSubscribeInstancesKey(
+       serviceName string,
+       notify registry.NotifyListener,
+) (initialSubscribeInstancesKey, error) {
+       if isNilNotifyListener(notify) {
+               return initialSubscribeInstancesKey{}, fmt.Errorf("notify 
listener type %T is nil", notify)
+       }
+       if !reflect.TypeOf(notify).Comparable() {

Review Comment:
   thanks,那我调整下设计,可比较 listener 继续走原路线 (baseline),不可比较listener  
在`LoadSubscribeInstances` 同步查询后,不缓存 baseline ,首个 watch 快照到达后,直接调用 
NotifyAll,用当前完整实例列表去更新 。不采取之前提到过的分配独立身份的方案,是因为涉及 `LoadSubscribeInstances` 和 
`Subscribe` 两次调用,初步判断需要修改公共接口才能建立可以重新识别的稳定身份



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