支持多线程

This commit is contained in:
Wenjie Zhang 2024-10-23 16:24:09 +08:00
parent 4a682e5107
commit c533f86b3f
3 changed files with 5 additions and 3 deletions

View File

@ -10,6 +10,8 @@ COPY ../requirements.txt /app/requirements.txt
# 安装依赖Docker 会缓存这一步,除非 requirements.txt 发生变化)
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install gunicorn
# 复制代码到容器中
COPY ../src /app/src

View File

@ -21,7 +21,7 @@ services:
- NEO4J_USERNAME=neo4j
- NEO4J_PASSWORD=0123456789
- MILVUS_URI=http://milvus:19530
command: uvicorn src.main:app --host 0.0.0.0 --port 5000 --reload
command: gunicorn src.main:app --bind 0.0.0.0:5000 --reload --workers 10 --worker-class uvicorn.workers.UvicornWorker
web:
build:
@ -125,4 +125,4 @@ services:
networks:
app-network:
driver: bridge
driver: bridge

View File

@ -10,7 +10,7 @@ data = APIRouter(prefix="/data")
logger = setup_logger("server-database")
@data.get("/")
async def get_databases():
def get_databases():
try:
database = startup.dbm.get_databases()
except Exception as e: