Closed wuteng606 closed 2 years ago
data_client文件中 zk 重连函数,for循环,遍历 map的keys,并且会触发 zookeeper-client:watcher事件
api_client中监听zookeeper-client:watcher 最终会触发data_client的invokeWithWatcher,因为是操作的同一个map _watchers 会导致一个死循环,map永远无法清空,所以需将data_client中的 for (const key of this._watchers.keys()) 替换为 const keys = [...this._watchers.keys()]; for(const key of keys)
data_client文件中 zk 重连函数,for循环,遍历 map的keys,并且会触发 zookeeper-client:watcher事件![image](https://user-images.githubusercontent.com/19469310/147430592-81f9dacf-bb17-4267-843d-902c4075a01a.png)
api_client中监听zookeeper-client:watcher 最终会触发data_client的invokeWithWatcher,因为是操作的同一个map _watchers 会导致一个死循环,map永远无法清空,所以需将data_client中的 for (const key of this._watchers.keys()) 替换为 const keys = [...this._watchers.keys()]; for(const key of keys)![image](https://user-images.githubusercontent.com/19469310/147430606-64dee065-b6fe-42ec-b962-0b8944a26bca.png)