diff --git a/gsuid_core/gss.py b/gsuid_core/gss.py index d38a85a..4e001aa 100644 --- a/gsuid_core/gss.py +++ b/gsuid_core/gss.py @@ -7,12 +7,12 @@ if not gss.is_load: gss.is_load = True gss.load_plugins() -repeat_jobs = {} -for i in scheduler.get_jobs(): - if i.name not in repeat_jobs: - repeat_jobs[i.name] = i - else: - logger.warning(f'发现重复函数名定时任务{i.name}, 移除该任务...') - scheduler.remove_job(i.id) + repeat_jobs = {} + for i in scheduler.get_jobs(): + if i.name not in repeat_jobs: + repeat_jobs[i.name] = i + else: + logger.warning(f'发现重复函数名定时任务{i.name}, 移除该任务...') + scheduler.remove_job(i.id) -del repeat_jobs + del repeat_jobs diff --git a/gsuid_core/logger.py b/gsuid_core/logger.py index 99092bb..9b7c582 100644 --- a/gsuid_core/logger.py +++ b/gsuid_core/logger.py @@ -68,12 +68,14 @@ def format_event(record): f'user_pm={event.user_pm}, ' f'content={content}, ' ) + message = message.replace('{', '{{').replace('}', '}}') else: message = '{message}' + def_name: str = record['name'] time = '{time:MM-DD HH:mm:ss}' level = '[{level}]' - def_name = '{name}' + def_name = f'{".".join(def_name.split(".")[-5:])}' return f'{time} {level} {def_name} | {message} \n' diff --git a/gsuid_core/server.py b/gsuid_core/server.py index 1978b6b..53def3d 100644 --- a/gsuid_core/server.py +++ b/gsuid_core/server.py @@ -19,7 +19,7 @@ class GsServer: def __new__(cls, *args, **kwargs): # 判断sv是否已经被初始化 if cls._instance is None: - cls._instance = super().__new__(cls) + cls._instance = super(GsServer, cls).__new__(cls, *args, **kwargs) return cls._instance def __init__(self): @@ -54,7 +54,7 @@ class GsServer: f'plugins.{plugin.name}.__init__' ) # 如果发现单文件,则视为单文件插件 - if plugin.suffix == '.py': + elif plugin.suffix == '.py': importlib.import_module(f'plugins.{plugin.name[:-3]}') except Exception as e: # noqa logger.exception(e) diff --git a/poetry.lock b/poetry.lock index 2cb9688..2086014 100644 --- a/poetry.lock +++ b/poetry.lock @@ -636,14 +636,14 @@ reference = "mirrors" [[package]] name = "fastapi" -version = "0.95.0" +version = "0.95.1" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "fastapi-0.95.0-py3-none-any.whl", hash = "sha256:daf73bbe844180200be7966f68e8ec9fd8be57079dff1bacb366db32729e6eb5"}, - {file = "fastapi-0.95.0.tar.gz", hash = "sha256:99d4fdb10e9dd9a24027ac1d0bd4b56702652056ca17a6c8721eec4ad2f14e18"}, + {file = "fastapi-0.95.1-py3-none-any.whl", hash = "sha256:a870d443e5405982e1667dfe372663abf10754f246866056336d7f01c21dab07"}, + {file = "fastapi-0.95.1.tar.gz", hash = "sha256:9569f0a381f8a457ec479d90fa01005cfddaae07546eb1f3fa035bc4797ae7d5"}, ] [package.dependencies] diff --git a/requirements.txt b/requirements.txt index f16dc0a..19692da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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" 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==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" 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"