[Bug fix] Import way to run

- Fix a bug that if you import the main app, especially when using gunicorn, you will miss some necessary initial operations. #216
This commit is contained in:
Lost-MSth
2025-08-06 17:29:05 +08:00
parent 46b3b053cf
commit 4911511ed7
2 changed files with 7 additions and 2 deletions

View File

@@ -89,7 +89,7 @@ It is just so interesting. What it can do is under exploration.
> 其它小改动请参考各个 commit 信息。
> Please refer to the commit messages for other minor changes.
### Version 2.12.0
### Version 2.12.1
> v2.12.0.1 ~ v2.12.0.10 for Arcaea 5.10.6 ~ 6.7.1
>

View File

@@ -170,7 +170,7 @@ def generate_log_file_dict(level: str, filename: str) -> dict:
}
def main():
def pre_main():
log_dict = {
'version': 1,
'root': {
@@ -208,6 +208,8 @@ def main():
input('Press ENTER key to exit.')
sys.exit()
def main():
if Config.LINKPLAY_HOST and Config.SET_LINKPLAY_SERVER_AS_SUB_PROCESS:
from linkplay_server import link_play
process = [Process(target=link_play, args=(
@@ -223,6 +225,9 @@ def main():
tcp_server_run()
# must run for init
pre_main()
if __name__ == '__main__':
set_start_method("spawn")
main()