watch_prefix method skips event if its value is None

This commit is contained in:
ahmadbilalkhalid 2019-07-03 17:53:22 +05:00
parent 59974e2047
commit 1b33377711
2 changed files with 6 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__

View File

@ -45,4 +45,8 @@ class Etcd3Wrapper(object):
def watch_prefix(self, *args, value_in_json=False, **kwargs):
r, _ = self.client.watch_prefix(*args, **kwargs)
for event in r:
yield EtcdEntry(event, event.value, value_in_json=value_in_json)
# if e.value is None don't propagate its value
if event.value is None:
continue
event = EtcdEntry(event, event.value, value_in_json=value_in_json)
yield event