Skip to content

Commit

Permalink
Merge pull request #1831 from st1020/fix/patch
Browse files Browse the repository at this point in the history
fix: patch
  • Loading branch information
Bidaya0 authored Sep 19, 2023
2 parents 2e21e77 + 11eb425 commit 7fbca8c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dongtai_conf/patch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def init_patch() -> None:
for module_info in pkgutil.iter_modules([str(PATCH_ROOT_PATH.resolve())]):
if not module_info.name.startswith("_"):
importlib.import_module("dongtai_conf.patch." + module_info.name)
logger.info(f"load patch dongtai_conf.patch.{module_info.name}")
is_init_patch = True


Expand All @@ -47,9 +48,11 @@ def patch_point(*args: Unpack[Ts]) -> tuple[Unpack[Ts]]:


def patch_point(*args: Any) -> Any:
init_patch()
patch_func = context_func.get()
patch_id = context_count.get()
context_count.set(patch_id + 1)
logger.debug(f"run patch on function: {patch_func} id: {patch_id}")
if patch_func in PATCH_HANDLER:
func = PATCH_HANDLER[patch_func][patch_id]
return_value = func(*args)
Expand Down

0 comments on commit 7fbca8c

Please sign in to comment.