mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-14 02:20:53 +08:00
fix: program restart error
This commit is contained in:
@@ -32,7 +32,7 @@ async def shutdown():
|
||||
)
|
||||
async def restart():
|
||||
try:
|
||||
resp = program.restart()
|
||||
resp = await program.restart()
|
||||
return u_response(resp)
|
||||
except Exception as e:
|
||||
logger.debug(e)
|
||||
@@ -97,7 +97,10 @@ async def shutdown_program():
|
||||
os.kill(os.getpid(), signal.SIGINT)
|
||||
return JSONResponse(
|
||||
status_code=200,
|
||||
content={"msg_en": "Shutdown program successfully.", "msg_zh": "关闭程序成功。"},
|
||||
content={
|
||||
"msg_en": "Shutdown program successfully.",
|
||||
"msg_zh": "关闭程序成功。",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,13 @@ import asyncio
|
||||
|
||||
from module.conf import VERSION, settings
|
||||
from module.models import ResponseModel
|
||||
from module.update import data_migration, first_run, from_30_to_31, start_up, cache_image
|
||||
from module.update import (
|
||||
data_migration,
|
||||
first_run,
|
||||
from_30_to_31,
|
||||
start_up,
|
||||
cache_image,
|
||||
)
|
||||
|
||||
from .sub_thread import RenameThread, RSSThread
|
||||
|
||||
@@ -71,7 +77,6 @@ class Program(RenameThread, RSSThread):
|
||||
msg_zh="程序启动成功。",
|
||||
)
|
||||
|
||||
|
||||
def stop(self):
|
||||
if self.is_running:
|
||||
self.stop_event.set()
|
||||
@@ -91,9 +96,9 @@ class Program(RenameThread, RSSThread):
|
||||
msg_zh="程序未运行。",
|
||||
)
|
||||
|
||||
def restart(self):
|
||||
async def restart(self):
|
||||
self.stop()
|
||||
self.start()
|
||||
await self.start()
|
||||
return ResponseModel(
|
||||
status=True,
|
||||
status_code=200,
|
||||
|
||||
Reference in New Issue
Block a user