This commit is contained in:
Leo Vasanko 2023-11-21 15:30:48 +00:00
parent ba9379ce9c
commit 8e93c96bb3
2 changed files with 5 additions and 6 deletions

View File

@ -8,15 +8,14 @@ from pathlib import Path, PurePath, PurePosixPath
from stat import S_IFDIR, S_IFREG
from urllib.parse import unquote
from wsgiref.handlers import format_date_time
import multiprocessing
import sys
from setproctitle import setproctitle
import brotli
import sanic.helpers
from blake3 import blake3
from sanic import Blueprint, Sanic, empty, raw, redirect
from sanic.exceptions import Forbidden, NotFound
from sanic.log import logger
from setproctitle import setproctitle
from stream_zip import ZIP_AUTO, stream_zip
from cista import auth, config, preview, session, watching
@ -40,9 +39,9 @@ setproctitle("cista-main")
async def main_start(app, loop):
config.load_config()
setproctitle(f"cista {config.config.path.name}")
N = max(2, min(8, cpu_count()))
workers = max(2, min(8, cpu_count()))
app.ctx.threadexec = ThreadPoolExecutor(
max_workers=N, thread_name_prefix="cista-ioworker"
max_workers=workers, thread_name_prefix="cista-ioworker"
)
await watching.start(app, loop)

View File

@ -135,7 +135,7 @@ def modifies_config(modify):
def load_config():
global config, conffile
global config
if conffile is None:
init_confdir()
config = msgspec.toml.decode(conffile.read_bytes(), type=Config, dec_hook=dec_hook)