simple queue, parallel router fetch as_completed , config autoupdate fixes

This commit is contained in:
Arseniy Kuznetsov
2022-12-30 19:11:07 +01:00
parent 27c71ee843
commit 660dd33369
6 changed files with 80 additions and 64 deletions

View File

@@ -11,7 +11,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import ThreadPoolExecutor, as_completed
from timeit import default_timer
from datetime import datetime
from mktxp.cli.config.config import config_handler
@@ -68,13 +68,11 @@ class CollectorHandler:
continue
# Publish the collection function as a future
future = executor.submit(self.collect_single, router_entry)
futures.append(future)
futures.append(executor.submit(self.collect_single, router_entry))
for future in as_completed(futures):
yield from future.result()
# Join all futures and collect their results
for future in futures:
results = future.result()
yield from results
def collect(self):
now = datetime.now().timestamp()