kragniz / kragniz/python-etcd3

Lazy etcd client watcher?

Open
#174 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
450
Forks
194
PR merge metrics
No merged PRs in 30d

Description

Hi, now in Etcd3Client's initialize function, the watcher member is a self-started thread, while watcher is not for all.

Initialize Etcd3Client while initializing watcher

```
self.watcher = watch.Watcher(etcdrpc.WatchStub(self.channel),
timeout=self.timeout)
```

Watcher is a auto-start daemon thread.

```
class Watcher(threading.Thread):

def __init__(self, watchstub, timeout=None):
threading.Thread.__init__(self)
self.timeout = timeout
self._watch_id_callbacks = {}
self._watch_id_queue = queue.Queue()
self._watch_id_lock = threading.Lock()
self._watch_requests_queue = queue.Queue()
self._watch_response_iterator = \
watchstub.Watch(self._requests_iterator)
self._callback = None
self.daemon = True
self.start()
```

Is there any consideration about lazy watcher thread start?

Contributor guide

Open the contributing guide

Research direction

Start at Etcd3Client.initialize and watch.Watcher.__init__, focusing on where the Watcher thread is created and started. Determine how a lazy watcher start would affect clients that do not use watching; the issue does not define a more specific completion condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.