Skip to content

Commit

Permalink
Refine if logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Hhhilulu committed Dec 7, 2023
1 parent f78e5f9 commit 658f0c9
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,10 @@ def _generate_thread_status_messages(self, pool: ThreadPool, total_count: int):

def _determine_worker_count(self):
worker_count = get_int_env_var("PF_WORKER_COUNT")
estimated_available_worker_count = None

if not self._use_fork:
# Starting a new process in non-fork mode requires to allocate memory. Calculate the maximum number of
# processes based on available memory to avoid memory bursting.
estimated_available_worker_count = get_available_max_worker_count()
# Starting a new process in non-fork mode requires to allocate memory. Calculate the maximum number of processes
# based on available memory to avoid memory bursting.
estimated_available_worker_count = get_available_max_worker_count() if not self._use_fork else None

# If the environment variable PF_WORKER_COUNT exists and valid, use the value as the worker_count.
if worker_count is not None and worker_count > 0:
Expand Down

0 comments on commit 658f0c9

Please sign in to comment.