🐛 优化一下BUG

This commit is contained in:
Wuyi无疑 2023-04-15 23:16:48 +08:00
parent e48daef821
commit b54ed4baa1
5 changed files with 17 additions and 15 deletions

View File

@ -7,12 +7,12 @@ if not gss.is_load:
gss.is_load = True gss.is_load = True
gss.load_plugins() gss.load_plugins()
repeat_jobs = {} repeat_jobs = {}
for i in scheduler.get_jobs(): for i in scheduler.get_jobs():
if i.name not in repeat_jobs: if i.name not in repeat_jobs:
repeat_jobs[i.name] = i repeat_jobs[i.name] = i
else: else:
logger.warning(f'发现重复函数名定时任务{i.name}, 移除该任务...') logger.warning(f'发现重复函数名定时任务{i.name}, 移除该任务...')
scheduler.remove_job(i.id) scheduler.remove_job(i.id)
del repeat_jobs del repeat_jobs

View File

@ -68,12 +68,14 @@ def format_event(record):
f'user_pm={event.user_pm}, ' f'user_pm={event.user_pm}, '
f'content={content}, ' f'content={content}, '
) )
message = message.replace('{', '{{').replace('}', '}}')
else: else:
message = '{message}' message = '{message}'
def_name: str = record['name']
time = '<g>{time:MM-DD HH:mm:ss}</g>' time = '<g>{time:MM-DD HH:mm:ss}</g>'
level = '[<lvl>{level}</lvl>]' level = '[<lvl>{level}</lvl>]'
def_name = '<c><u>{name}</u></c>' def_name = f'<c><u>{".".join(def_name.split(".")[-5:])}</u></c>'
return f'{time} {level} {def_name} | {message} \n' return f'{time} {level} {def_name} | {message} \n'

View File

@ -19,7 +19,7 @@ class GsServer:
def __new__(cls, *args, **kwargs): def __new__(cls, *args, **kwargs):
# 判断sv是否已经被初始化 # 判断sv是否已经被初始化
if cls._instance is None: if cls._instance is None:
cls._instance = super().__new__(cls) cls._instance = super(GsServer, cls).__new__(cls, *args, **kwargs)
return cls._instance return cls._instance
def __init__(self): def __init__(self):
@ -54,7 +54,7 @@ class GsServer:
f'plugins.{plugin.name}.__init__' f'plugins.{plugin.name}.__init__'
) )
# 如果发现单文件,则视为单文件插件 # 如果发现单文件,则视为单文件插件
if plugin.suffix == '.py': elif plugin.suffix == '.py':
importlib.import_module(f'plugins.{plugin.name[:-3]}') importlib.import_module(f'plugins.{plugin.name[:-3]}')
except Exception as e: # noqa except Exception as e: # noqa
logger.exception(e) logger.exception(e)

6
poetry.lock generated
View File

@ -636,14 +636,14 @@ reference = "mirrors"
[[package]] [[package]]
name = "fastapi" name = "fastapi"
version = "0.95.0" version = "0.95.1"
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
category = "main" category = "main"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "fastapi-0.95.0-py3-none-any.whl", hash = "sha256:daf73bbe844180200be7966f68e8ec9fd8be57079dff1bacb366db32729e6eb5"}, {file = "fastapi-0.95.1-py3-none-any.whl", hash = "sha256:a870d443e5405982e1667dfe372663abf10754f246866056336d7f01c21dab07"},
{file = "fastapi-0.95.0.tar.gz", hash = "sha256:99d4fdb10e9dd9a24027ac1d0bd4b56702652056ca17a6c8721eec4ad2f14e18"}, {file = "fastapi-0.95.1.tar.gz", hash = "sha256:9569f0a381f8a457ec479d90fa01005cfddaae07546eb1f3fa035bc4797ae7d5"},
] ]
[package.dependencies] [package.dependencies]

View File

@ -19,7 +19,7 @@ dnspython==2.3.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
email-validator==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" email-validator==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
fastapi-amis-admin==0.5.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi-amis-admin==0.5.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
fastapi==0.95.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi==0.95.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
frozenlist==1.3.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" frozenlist==1.3.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
gitpython==3.1.31 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" gitpython==3.1.31 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"