mirror of
https://github.com/KevinMidboe/mktxp-no-cli.git
synced 2025-12-08 20:38:48 +00:00
fixes/optimizations
This commit is contained in:
@@ -35,7 +35,7 @@ class CollectorHandler:
|
||||
Thus, the total runtime of this function scales linearly with the number of registered routers.
|
||||
"""
|
||||
for router_entry in self.entries_handler.router_entries:
|
||||
if not router_entry.is_connected():
|
||||
if not router_entry.is_ready():
|
||||
# let's pick up on things in the next run
|
||||
continue
|
||||
|
||||
@@ -87,7 +87,7 @@ class CollectorHandler:
|
||||
print(f'Hit overall timeout while scraping router entry: {router_entry.router_id[MKTXPConfigKeys.ROUTERBOARD_NAME]}')
|
||||
break
|
||||
|
||||
if not router_entry.is_connected():
|
||||
if not router_entry.is_ready():
|
||||
# let's pick up on things in the next run
|
||||
continue
|
||||
|
||||
|
||||
@@ -54,16 +54,14 @@ class RouterEntry:
|
||||
'MKTXPCollector': 0
|
||||
}
|
||||
|
||||
def is_connected(self):
|
||||
connected = True
|
||||
def is_ready(self):
|
||||
is_ready = True
|
||||
self.wifi_package = None
|
||||
if not self.api_connection.is_connected():
|
||||
connected = False
|
||||
is_ready = False
|
||||
# let's get connected now
|
||||
self.api_connection.connect()
|
||||
if self.dhcp_entry:
|
||||
self.dhcp_entry.api_connection.connect()
|
||||
|
||||
return connected
|
||||
|
||||
|
||||
|
||||
return is_ready
|
||||
|
||||
Reference in New Issue
Block a user