From 8e93c96bb3f71e571706b243d6e8eb27289546db Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 21 Nov 2023 15:30:48 +0000 Subject: [PATCH] Cleanup --- cista/app.py | 9 ++++----- cista/config.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cista/app.py b/cista/app.py index ab3f47a..a87cef1 100644 --- a/cista/app.py +++ b/cista/app.py @@ -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) diff --git a/cista/config.py b/cista/config.py index 6f88213..03fbfdd 100644 --- a/cista/config.py +++ b/cista/config.py @@ -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)