Skip to content

Commit

Permalink
refactor: 修改默认worker计算方法 (1Panel-dev#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 authored Dec 4, 2024
1 parent a71adf1 commit fd35ef2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/common/management/commands/services/command.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import math

from django.core.management.base import BaseCommand
from django.db.models import TextChoices

Expand Down Expand Up @@ -93,7 +95,8 @@ def add_arguments(self, parser):
'services', nargs='+', choices=Services.export_services_values(), help='Service',
)
parser.add_argument('-d', '--daemon', nargs="?", const=True)
parser.add_argument('-w', '--worker', type=int, nargs="?", default=3 if os.cpu_count() > 3 else os.cpu_count())
parser.add_argument('-w', '--worker', type=int, nargs="?",
default=3 if os.cpu_count() > 6 else math.floor(os.cpu_count() / 2))
parser.add_argument('-f', '--force', nargs="?", const=True)

def initial_util(self, *args, **options):
Expand Down

0 comments on commit fd35ef2

Please sign in to comment.