AlexStocks commented on code in PR #3482:
URL: https://github.com/apache/dubbo-go/pull/3482#discussion_r3563600384
##########
registry/polaris/registry.go:
##########
@@ -169,6 +165,22 @@ func (pr *polarisRegistry) Subscribe(url *common.URL,
notifyListener registry.No
}
}
+// createPolarisListener creates or reuses the service watcher, transfers its
pending baseline,
+// and only then invokes newListener so the watcher cannot start before
snapshot injection.
+func (pr *polarisRegistry) createPolarisListener(
+ serviceName string,
+ newListener func(*PolarisServiceWatcher) (*polarisListener, error),
+) (*polarisListener, error) {
+ watcher, err := pr.createPolarisWatcher(serviceName)
+ if err != nil {
+ return nil, err
+ }
+ if initialSnapshot, ok := pr.takeInitialSnapshot(serviceName); ok {
Review Comment:
[P0] 这里把每次 `LoadSubscribeInstances` 的基线都交给按 service 复用的 watcher,但 watcher
在第一次完整快照后会将 `initialSnapshotConsumed` 永久置为 true。后续同一 service
新增订阅者时,`takeInitialSnapshot` 会删除其基线,而 `setInitialSnapshot`
直接忽略;若实例在同步加载与监听器注册之间消失,该订阅者不会收到删除事件,会长期保留失效 provider。需要按 listener 保存并对账基线,或在复用
watcher 时立即用当前完整快照对新 listener 做差异通知。
--
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]