fixed some bugs with the new "threaded" approach

This commit is contained in:
UpstreamData
2021-12-21 12:49:41 -07:00
parent df6858d718
commit e936a11477
3 changed files with 6 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ from config.bos import bos_config_convert, general_config_convert_bos
from API import APIError
from settings import CFG_UTIL_GET_VERSION_THREADS as GET_VERSION_THREADS
from settings import CFG_UTIL_CONFIG_THREADS as CONFIG_THREADS
async def update_ui_with_data(key, data, append=False):
if append:
@@ -101,11 +101,12 @@ async def send_config(ips: list, config):
miners = await asyncio.gather(*tasks)
tasks = []
for miner in miners:
if len(tasks) < GET_VERSION_THREADS:
if len(tasks) < CONFIG_THREADS:
tasks.append(miner.send_config(config))
else:
await asyncio.gather(*tasks)
tasks = []
await asyncio.gather(*tasks)
await update_ui_with_data("status", "")

View File

@@ -39,6 +39,7 @@ class MinerNetwork:
miner_ips_scan = await asyncio.gather(*scan_tasks)
miner_ips.extend(miner_ips_scan)
scan_tasks = []
await asyncio.gather(*scan_tasks)
miner_ips = list(filter(None, miner_ips))
print(f"Found {len(miner_ips)} connected miners...")
create_miners_tasks = []

View File

@@ -1,7 +1,7 @@
NETWORK_PING_RETRIES: int = 3
NETWORK_PING_TIMEOUT: int = 5
NETWORK_SCAN_THREADS: int = 100
NETWORK_SCAN_THREADS: int = 300
CFG_UTIL_GET_VERSION_THREADS: int = 100
CFG_UTIL_CONFIG_THREADS: int = 300
MINER_FACTORY_GET_VERSION_RETRIES: int = 3