From f952b81ccff52c1a8002c6a54f424139c1338505 Mon Sep 17 00:00:00 2001 From: kingbri Date: Thu, 21 Mar 2024 23:23:45 -0400 Subject: [PATCH] API: Remove uvicorn signal handler injection This causes spamming of warn statements on SIGINT. The message also gets printed on a normal shutdown (that isn't in the middle of a request). Signed-off-by: kingbri --- endpoints/OAI/app.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/endpoints/OAI/app.py b/endpoints/OAI/app.py index c448eb75..84b7bde3 100644 --- a/endpoints/OAI/app.py +++ b/endpoints/OAI/app.py @@ -1,8 +1,6 @@ import asyncio import pathlib -import signal import uvicorn -from contextlib import asynccontextmanager from fastapi import FastAPI, Depends, HTTPException, Header, Request from fastapi.middleware.cors import CORSMiddleware from functools import partial @@ -19,7 +17,6 @@ ) from common.logger import UVICORN_LOG_CONFIG from common.networking import handle_request_error, run_with_request_disconnect -from common.signals import uvicorn_signal_handler from common.templating import ( get_all_templates, get_template_from_file, @@ -59,14 +56,6 @@ from endpoints.OAI.utils.model import get_model_list, stream_model_load from endpoints.OAI.utils.lora import get_lora_list - -@asynccontextmanager -async def lifespan(_: FastAPI): - uvicorn_signal_handler(signal.SIGINT) - uvicorn_signal_handler(signal.SIGTERM) - yield - - app = FastAPI( title="TabbyAPI", summary="An OAI compatible exllamav2 API that's both lightweight and fast", @@ -74,7 +63,6 @@ async def lifespan(_: FastAPI): "This docs page is not meant to send requests! Please use a service " "like Postman or a frontend UI." ), - lifespan=lifespan, ) # ALlow CORS requests