From 3d6226c07671ae21d7be16f663f4d5aca1ceaed4 Mon Sep 17 00:00:00 2001 From: Arthus Golubtsov Date: Mon, 8 Apr 2019 13:31:01 +0100 Subject: [PATCH] Client: Add workaround to load cpu lower when process connections --- Drone/client.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Drone/client.py b/Drone/client.py index f824e5e..aeb5954 100644 --- a/Drone/client.py +++ b/Drone/client.py @@ -7,6 +7,7 @@ import logging import collections import ConfigParser import selectors2 as selectors +import threading from contextlib import closing @@ -205,11 +206,20 @@ class Client(object): if isinstance(error, OSError): if error.errno == errno.EINTR: raise KeyboardInterrupt + else: + time.sleep(0.001) if not self.selector.get_map(): logger.warning("No active connections left!") return + time.sleep(0.001) + + #def connection_processor(self): + # while not self._shutdown_event.is_set(): + # self._running_event.wait() + # self._process_connections() + @messaging.request_callback("id") def _response_id():