jplana / python-etcd

A python client for etcd
Other
522 stars 210 forks source link

watch a dir failed #233

Closed DjangoPeng closed 7 years ago

DjangoPeng commented 7 years ago

I'm trying the watch method, but I found it can't watch the changes of a directory.

Environment

etcd server:

localhost:2379

etcd directory tree:

/test/name 
/test/label

I created a python-etcd client and watched the /test/ directory.

import etcd
client = etcd.Client(host="localhost", port=2379)
client.watch("/test/")
# client.watch("/test/*")  # failed either in this way

Then I use the etcdctl to set a new key-value in /test/:

$ etcdctl set /test/watchme "hello watch"
$ etcdctl get /test/watchme
hello watch

It's obvious that I set a new key successfully, but the python-etcd client is still blocked util EtcdWatchTimeOut.

What's wrong with my test, buddy?

DjangoPeng commented 7 years ago

I lost the recursive argument. Close this issue.