Skip to content

Commit

Permalink
feat(event): add ModuleReload event type
Browse files Browse the repository at this point in the history
  • Loading branch information
InfinityPacer committed Sep 30, 2024
1 parent 835e0b4 commit 0ca4223
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/core/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
from typing import Generator, Optional, Tuple, Any

from app.core.config import settings
from app.core.event import eventmanager
from app.helper.module import ModuleHelper
from app.log import logger
from app.schemas.types import EventType
from app.utils.object import ObjectUtils
from app.utils.singleton import Singleton

Expand Down Expand Up @@ -67,6 +69,7 @@ def reload(self):
"""
self.stop()
self.load_modules()
eventmanager.send_event(etype=EventType.ModuleReload, data={})

def test(self, modleid: str) -> Tuple[bool, str]:
"""
Expand Down
2 changes: 2 additions & 0 deletions app/schemas/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class EventType(Enum):
SystemError = "system.error"
# 刮削元数据
MetadataScrape = "metadata.scrape"
# 模块需要重载
ModuleReload = "module.reload"


# 同步链式事件
Expand Down

0 comments on commit 0ca4223

Please sign in to comment.