Skip to content

Commit

Permalink
Merge pull request #860 from EstrellaXD/3.1-dev
Browse files Browse the repository at this point in the history
3.1.17
  • Loading branch information
Rewrite0 authored Sep 26, 2024
2 parents 95dc62e + 18471d0 commit 58e07ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 5 additions & 2 deletions backend/src/module/api/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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": "关闭程序成功。",
},
)


Expand Down
13 changes: 9 additions & 4 deletions backend/src/module/core/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

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

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


def stop(self):
if self.is_running:
self.stop_event.set()
Expand All @@ -91,9 +96,9 @@ def stop(self):
msg_zh="程序未运行。",
)

def restart(self):
async def restart(self):
self.stop()
self.start()
await self.start()
return ResponseModel(
status=True,
status_code=200,
Expand Down

0 comments on commit 58e07ea

Please sign in to comment.