diff --git a/relay.spec b/relay.spec index 8f84331..45fb419 100644 --- a/relay.spec +++ b/relay.spec @@ -16,8 +16,8 @@ a = Analysis( (aiohttp_swagger_path, 'aiohttp_swagger') ], hiddenimports=[ - 'gunicorn', - 'gunicorn.glogging' + 'pg8000', + 'sqlite3' ], hookspath=[], hooksconfig={}, diff --git a/relay/application.py b/relay/application.py index 02fe73c..f7007b0 100644 --- a/relay/application.py +++ b/relay/application.py @@ -7,6 +7,7 @@ import signal import subprocess import sys import time +import traceback import typing from aiohttp import web diff --git a/relay/config.py b/relay/config.py index 94bc293..b6963bd 100644 --- a/relay/config.py +++ b/relay/config.py @@ -2,6 +2,7 @@ from __future__ import annotations import getpass import os +import platform import typing import yaml @@ -13,11 +14,19 @@ if typing.TYPE_CHECKING: from typing import Any +if platform.system() == 'Windows': + import multiprocessing + CORE_COUNT = multiprocessing.cpu_count() + +else: + CORE_COUNT = len(os.sched_getaffinity(0)) + + DEFAULTS: dict[str, Any] = { 'listen': '0.0.0.0', 'port': 8080, 'domain': 'relay.example.com', - 'workers': len(os.sched_getaffinity(0)), + 'workers': CORE_COUNT, 'db_type': 'sqlite', 'ca_type': 'database', 'sq_path': 'relay.sqlite3',