diff options
author | Dana Powers <dana.powers@gmail.com> | 2019-03-23 09:00:45 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2019-03-23 09:00:45 -0700 |
commit | 545cdb10cf86ec24ac4f01b46b8ffaf0ab8c016e (patch) | |
tree | f46e729716ab88170cd65fcd4b5a37c86c53819f /kafka/client_async.py | |
parent | 3c5dfef52da589250e069e82ff3f12e013ead4db (diff) | |
download | kafka-python-sender_dont_wakeup.tar.gz |
Avoid call to wakeup from sender thread for maybe_connectsender_dont_wakeup
Diffstat (limited to 'kafka/client_async.py')
-rw-r--r-- | kafka/client_async.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py index cff172f..ce1c795 100644 --- a/kafka/client_async.py +++ b/kafka/client_async.py @@ -321,14 +321,15 @@ class KafkaClient(object): log.warning("Node %s connection failed -- refreshing metadata", node_id) self.cluster.request_update() - def maybe_connect(self, node_id): + def maybe_connect(self, node_id, wakeup=True): """Queues a node for asynchronous connection during the next .poll()""" if self._can_connect(node_id): self._connecting.add(node_id) # Wakeup signal is useful in case another thread is # blocked waiting for incoming network traffic while holding # the client lock in poll(). - self.wakeup() + if wakeup: + self.wakeup() return True return False |