From f28985c9862615f632e2eae37dd55ad3382629a7 Mon Sep 17 00:00:00 2001 From: ppigazzini Date: Thu, 9 Jan 2025 14:55:45 +0100 Subject: [PATCH] Simplify futures --- worker/games.py | 11 +++-------- worker/sri.txt | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/worker/games.py b/worker/games.py index 1f72fd3c2..6beab913a 100644 --- a/worker/games.py +++ b/worker/games.py @@ -1,4 +1,3 @@ -import concurrent.futures import copy import ctypes import hashlib @@ -18,6 +17,7 @@ import threading import time from base64 import b64decode +from concurrent.futures import ProcessPoolExecutor from datetime import datetime, timedelta, timezone from pathlib import Path from queue import Empty, Queue @@ -435,13 +435,8 @@ def verify_signature(engine, signature, active_cores): ) ) - with concurrent.futures.ProcessPoolExecutor(max_workers=active_cores) as executor: - futures = [ - executor.submit(run_single_bench, engine) for _ in range(active_cores) - ] - results = [ - future.result() for future in concurrent.futures.as_completed(futures) - ] + with ProcessPoolExecutor(max_workers=active_cores) as executor: + results = list(executor.map(run_single_bench, [engine] * active_cores)) bench_nps = 0.0 diff --git a/worker/sri.txt b/worker/sri.txt index 11217a273..40ff92477 100644 --- a/worker/sri.txt +++ b/worker/sri.txt @@ -1 +1 @@ -{"__version": 247, "updater.py": "Mg+pWOgGA0gSo2TuXuuLCWLzwGwH91rsW1W3ixg3jYauHQpRMtNdGnCfuD1GqOhV", "worker.py": "fnKb7BjtNafSyeNEDD4R8km3YFzO0SvQHVdn252B3lDsV2wxLr3mG6SxqCVw8Sqg", "games.py": "gzokk+Sghkt4JXG8cyz9nADt3hRObZNn2DazCJOOjRtOTDvldcp5r0ek0zlsAarT"} +{"__version": 247, "updater.py": "Mg+pWOgGA0gSo2TuXuuLCWLzwGwH91rsW1W3ixg3jYauHQpRMtNdGnCfuD1GqOhV", "worker.py": "fnKb7BjtNafSyeNEDD4R8km3YFzO0SvQHVdn252B3lDsV2wxLr3mG6SxqCVw8Sqg", "games.py": "8aK1JFbnWn5KKEgAHyiyw1gG1PkOjXAWm7CKZUIgNFlbdkekfpN8+32o5UpupttW"}