fix: program restart error

This commit is contained in:
Rewrite0
2024-09-26 09:15:54 +08:00
parent 94329ae544
commit 22dfed741e
2 changed files with 14 additions and 6 deletions

View File

@@ -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,