AlexStocks commented on code in PR #3282:
URL: https://github.com/apache/dubbo-go/pull/3282#discussion_r3041495932


##########
registry/directory/directory.go:
##########
@@ -271,34 +271,49 @@ func (dir *RegistryDirectory) refreshInvokers(event 
*registry.ServiceEvent) {
 // not in the incoming list can be removed.  The Action of serviceEvent should 
be EventTypeUpdate or EventTypeAdd.
 func (dir *RegistryDirectory) refreshAllInvokers(events 
[]*registry.ServiceEvent, callback func()) {
        var (
-               oldInvokers []protocolbase.Invoker
-               addEvents   []*registry.ServiceEvent
+               oldInvokers      []protocolbase.Invoker
+               addEvents        []*registry.ServiceEvent
+               providerEvents   []*registry.ServiceEvent
+               configuratorURLs []*common.URL
        )
-       dir.overrideUrl(dir.GetDirectoryUrl())
-       referenceUrl := dir.GetDirectoryUrl().SubURL
-
-       // loop the events to check the Action should be EventTypeUpdate.
        for _, event := range events {
                if event.Action != remoting.EventTypeUpdate && event.Action != 
remoting.EventTypeAdd {
                        panic("Your implements of register center is wrong, " +
                                "please check the Action of ServiceEvent should 
be EventTypeUpdate")
                }
+               if isConfiguratorURL(event.Service) {
+                       configuratorURLs = append(configuratorURLs, 
event.Service)
+                       continue
+               }
+               providerEvents = append(providerEvents, event)
+       }
+       if configuratorURLs != nil {
+               dir.replaceConfigurators(configuratorURLs)
+       }
+       defer callback()
+       if len(providerEvents) == 0 && len(events) > 0 {
+               return

Review Comment:
   [P1] 这里在 configurator-only 的 `NotifyAll` 场景下直接 `return`,只替换了 
`dir.configurators`,但没有把新规则重新应用到已经缓存的 invoker。结果就是这批 override 要等下一次 provider 
事件或配置中心事件触发后才会真正生效,Alan 之前提的那个语义问题还在。建议这里要么遍历 `cacheInvokersMap` 按原始 provider 
URL 重新 `overrideUrl + doCacheInvoker`,要么至少补一个覆盖现有 cached invoker 立即刷新行为的测试,确保纯 
configurator 批次不会静默延迟。



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