diff --git a/spinach/worker.py b/spinach/worker.py index 4c0c71a..cf44012 100644 --- a/spinach/worker.py +++ b/spinach/worker.py @@ -44,7 +44,7 @@ def __init__(self, num_workers: int, namespace: str): self._must_stop = threading.Event() self.poison_pill = object() - for i in range(num_workers): + for i in range(1, num_workers + 1): thread = threading.Thread( target=self._worker_func, name='{}-worker-{}'.format(self._namespace, i) diff --git a/tests/test_worker.py b/tests/test_worker.py index 0895d88..7a924e3 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -136,10 +136,10 @@ def test_worker_signals(job): mock_job_started_receiver.assert_called_once_with(ns, job=ANY) mock_job_finished_receiver.assert_called_once_with(ns, job=ANY) mock_worker_started_receiver.assert_called_once_with( - ns, worker_name='tests-worker-0' + ns, worker_name='tests-worker-1' ) mock_worker_terminated_receiver.assert_called_once_with( - ns, worker_name='tests-worker-0' + ns, worker_name='tests-worker-1' )