multitasking
This commit is contained in:
parent
97618549c5
commit
f77164f90a
@ -131,9 +131,11 @@ class SiteChain(ChainBase):
|
||||
"""
|
||||
if not arg_str:
|
||||
return
|
||||
arg_str = str(arg_str).strip()
|
||||
arg_strs = str(arg_str).split()
|
||||
for arg_str in arg_strs:
|
||||
arg_str = arg_str.strip()
|
||||
if not arg_str.isdigit():
|
||||
return
|
||||
continue
|
||||
site_id = int(arg_str)
|
||||
site = self.siteoper.get(site_id)
|
||||
if not site:
|
||||
|
@ -501,9 +501,11 @@ class SubscribeChain(ChainBase):
|
||||
self.post_message(title="请输入正确的命令格式:/subscribe_delete [id],"
|
||||
"[id]为订阅编号", userid=userid)
|
||||
return
|
||||
arg_strs = str(arg_str).split()
|
||||
for arg_str in arg_strs:
|
||||
arg_str = arg_str.strip()
|
||||
if not arg_str.isdigit():
|
||||
return
|
||||
continue
|
||||
subscribe_id = int(arg_str)
|
||||
subscribe = self.subscribehelper.get(subscribe_id)
|
||||
if not subscribe:
|
||||
|
@ -1,3 +1,5 @@
|
||||
import multiprocessing
|
||||
|
||||
import uvicorn as uvicorn
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
@ -26,7 +28,8 @@ App.add_middleware(
|
||||
)
|
||||
|
||||
# uvicorn服务
|
||||
Server = uvicorn.Server(Config(App, host=settings.HOST, port=settings.PORT, reload=settings.DEBUG))
|
||||
Server = uvicorn.Server(Config(App, host=settings.HOST, port=settings.PORT,
|
||||
reload=settings.DEBUG, workers=multiprocessing.cpu_count()))
|
||||
|
||||
|
||||
def init_routers():
|
||||
|
@ -1,5 +1,6 @@
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
worker_processes auto;
|
||||
worker_cpu_affinity auto;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
|
Loading…
x
Reference in New Issue
Block a user