MCPcopy Create free account
hub / github.com/apache/dubbo-python2 / _watch_children

Method _watch_children

dubbo/client.py:173–190  ·  view source on GitHub ↗

对某个provider下的子节点进行监听,一旦provider发生了变化则对本地缓存进行更新 :param event: :return:

(self, event)

Source from the content-addressed store, hash-verified

171 self.weights[interface] = conf
172
173 def _watch_children(self, event):
174 """
175 对某个provider下的子节点进行监听,一旦provider发生了变化则对本地缓存进行更新
176 :param event:
177 :return:
178 """
179 path = event.path
180 logger.debug('zookeeper node changed: {}'.format(path))
181 interface = path.split('/')[2]
182
183 providers = self.zk.get_children(path, watch=self._watch_children)
184 providers = filter(lambda provider: provider['scheme'] == 'dubbo', map(parse_url, providers))
185 if not providers:
186 logger.debug('no providers for interface {}'.format(interface))
187 self.hosts[interface] = []
188 return
189 self.hosts[interface] = map(lambda provider: provider['host'], providers)
190 logger.debug('{} providers: {}'.format(interface, self.hosts[interface]))
191
192 def _watch_configurators(self, event):
193 """

Callers

nothing calls this directly

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected