Skip to content

Commit 58e07ea

Browse files
authored
Merge pull request #860 from EstrellaXD/3.1-dev
3.1.17
2 parents 95dc62e + 18471d0 commit 58e07ea

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

backend/src/module/api/program.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async def shutdown():
3232
)
3333
async def restart():
3434
try:
35-
resp = program.restart()
35+
resp = await program.restart()
3636
return u_response(resp)
3737
except Exception as e:
3838
logger.debug(e)
@@ -97,7 +97,10 @@ async def shutdown_program():
9797
os.kill(os.getpid(), signal.SIGINT)
9898
return JSONResponse(
9999
status_code=200,
100-
content={"msg_en": "Shutdown program successfully.", "msg_zh": "关闭程序成功。"},
100+
content={
101+
"msg_en": "Shutdown program successfully.",
102+
"msg_zh": "关闭程序成功。",
103+
},
101104
)
102105

103106

backend/src/module/core/program.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33

44
from module.conf import VERSION, settings
55
from module.models import ResponseModel
6-
from module.update import data_migration, first_run, from_30_to_31, start_up, cache_image
6+
from module.update import (
7+
data_migration,
8+
first_run,
9+
from_30_to_31,
10+
start_up,
11+
cache_image,
12+
)
713

814
from .sub_thread import RenameThread, RSSThread
915

@@ -71,7 +77,6 @@ async def start(self):
7177
msg_zh="程序启动成功。",
7278
)
7379

74-
7580
def stop(self):
7681
if self.is_running:
7782
self.stop_event.set()
@@ -91,9 +96,9 @@ def stop(self):
9196
msg_zh="程序未运行。",
9297
)
9398

94-
def restart(self):
99+
async def restart(self):
95100
self.stop()
96-
self.start()
101+
await self.start()
97102
return ResponseModel(
98103
status=True,
99104
status_code=200,

0 commit comments

Comments
 (0)