From 04a916b026dd3fc542af5a490a7a906c971f4f96 Mon Sep 17 00:00:00 2001 From: "Dr.Caduceus" Date: Thu, 9 Nov 2023 14:01:26 +0530 Subject: [PATCH] Bump to v1.3 --- bot/server/__init__.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bot/server/__init__.py b/bot/server/__init__.py index 9d52220..13a8f36 100644 --- a/bot/server/__init__.py +++ b/bot/server/__init__.py @@ -1,13 +1,13 @@ from quart import Quart -from hypercorn import Config -from hypercorn.asyncio import serve +from uvicorn import Server as UvicornServer, Config from logging import getLogger from bot.config import Server, LOGGER_CONFIG_JSON from . import main, error -logger = getLogger('hypercorn') +logger = getLogger('uvicorn') instance = Quart(__name__) +instance.config['RESPONSE_TIMEOUT'] = None @instance.before_serving async def before_serve(): @@ -21,9 +21,11 @@ instance.register_error_handler(404, error.not_found) instance.register_error_handler(405, error.invalid_method) instance.register_error_handler(error.HTTPError, error.http_error) -async def run_server(): - config = Config() - config.bind = [f'{Server.BIND_ADDRESS}:{Server.PORT}'] - config.logconfig_dict = LOGGER_CONFIG_JSON - - await serve(instance, config) +server = UvicornServer ( + Config ( + app=instance, + host=Server.BIND_ADDRESS, + port=Server.PORT, + log_config=LOGGER_CONFIG_JSON + ) +)