Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm redundant errors #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 31 additions & 28 deletions nacos/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,35 +813,38 @@ def _init_pulling(self):
logger.info("[init-pulling] init completed")

def _process_polling_result(self):
while True:
cache_key, content, md5 = self.notify_queue.get()
logger.info("[process-polling-result] receive an event:%s" % cache_key)
wl = self.watcher_mapping.get(cache_key)
if not wl:
logger.warning("[process-polling-result] no watcher on %s, ignored" % cache_key)
continue
try:
while True:
cache_key, content, md5 = self.notify_queue.get()
logger.info("[process-polling-result] receive an event:%s" % cache_key)
wl = self.watcher_mapping.get(cache_key)
if not wl:
logger.warning("[process-polling-result] no watcher on %s, ignored" % cache_key)
continue

data_id, group, namespace = parse_key(cache_key)
plain_content = content

params = {
"data_id": data_id,
"group": group,
"namespace": namespace,
"raw_content": content,
"content": plain_content,
}
for watcher in wl:
if not watcher.last_md5 == md5:
logger.info(
"[process-polling-result] md5 changed since last call, calling %s with changed md5: %s ,params: %s"
% (watcher.callback.__name__, md5, params))
try:
self.callback_tread_pool.apply(watcher.callback, (params,))
except Exception as e:
logger.exception("[process-polling-result] exception %s occur while calling %s " % (
str(e), watcher.callback.__name__))
watcher.last_md5 = md5
data_id, group, namespace = parse_key(cache_key)
plain_content = content

params = {
"data_id": data_id,
"group": group,
"namespace": namespace,
"raw_content": content,
"content": plain_content,
}
for watcher in wl:
if not watcher.last_md5 == md5:
logger.info(
"[process-polling-result] md5 changed since last call, calling %s with changed md5: %s ,params: %s"
% (watcher.callback.__name__, md5, params))
try:
self.callback_tread_pool.apply(watcher.callback, (params,))
except Exception as e:
logger.exception("[process-polling-result] exception %s occur while calling %s " % (
str(e), watcher.callback.__name__))
watcher.last_md5 = md5
except (EOFError, OSError) as e:
logger.exception(f"[process-polling-result] break when receive exception of {type(e)}")

@staticmethod
def _inject_version_info(headers):
Expand Down