1
0
mirror of https://github.com/thingsboard/thingsboard-gateway synced 2025-10-26 22:31:42 +08:00

Fixed higt load CPU usage

This commit is contained in:
samson0v
2021-11-01 17:08:23 +02:00
parent 6aa9d0b648
commit 83ef704f75
4 changed files with 12 additions and 11 deletions

View File

@@ -137,7 +137,7 @@ class TBClient(threading.Thread):
while not self.__stopped:
try:
if not self.__stopped:
time.sleep(.1)
time.sleep(.2)
else:
break
except KeyboardInterrupt:

View File

@@ -195,7 +195,7 @@ class TBGatewayService:
self.__rpc_requests_in_progress = new_rpc_request_in_progress
else:
try:
sleep(.1)
sleep(0.2)
except Exception as e:
log.exception(e)
break
@@ -417,6 +417,7 @@ class TBGatewayService:
log.error('Data from the device "%s" cannot be saved, connector name is %s.',
data["deviceName"],
connector_name)
sleep(0.2)
except Exception as e:
log.error(e)
@@ -480,7 +481,7 @@ class TBGatewayService:
if not self.tb_client.is_connected():
continue
while self.__rpc_reply_sent:
sleep(.01)
sleep(.2)
self.__send_data(devices_data_in_event_pack)
sleep(self.__min_pack_send_delay_ms)
@@ -508,7 +509,7 @@ class TBGatewayService:
except Exception as e:
log.exception(e)
success = False
sleep(.01)
sleep(0.2)
if success:
self._event_storage.event_pack_processing_done()
del devices_data_in_event_pack
@@ -516,9 +517,9 @@ class TBGatewayService:
else:
continue
else:
sleep(.01)
sleep(0.2)
else:
sleep(.1)
sleep(0.2)
except Exception as e:
log.exception(e)
sleep(1)