Skip to content

Commit de4b940

Browse files
committed
worker: actually default to number of cores for worker count
1 parent 86f01d6 commit de4b940

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

buildbot_nix/buildbot_nix/worker.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ class WorkerConfig:
2525
worker_name: str = field(
2626
default_factory=lambda: os.environ.get("WORKER_NAME", socket.gethostname())
2727
)
28-
worker_count_str: str | None = os.environ.get("WORKER_COUNT")
29-
if worker_count_str is not None:
30-
worker_count = int(worker_count_str)
31-
else:
28+
worker_count_str: str = os.environ.get("WORKER_COUNT", "0")
29+
worker_count = int(worker_count_str)
30+
31+
if worker_count == 0:
3232
worker_count = multiprocessing.cpu_count()
33+
3334
buildbot_dir: Path = field(
3435
default_factory=lambda: Path(require_env("BUILDBOT_DIR"))
3536
)

0 commit comments

Comments
 (0)