aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/hrc/core.py
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2024-07-18 23:21:38 +0800
committer简律纯 <i@jyunko.cn>2024-07-18 23:21:38 +0800
commit14368e5a7bdcc4b6d3b151ecd9cb3162c30f292e (patch)
tree1638e77fa1e7b084e764a9f924005433d692d171 /hrc/core.py
parent0f39a9dfbbb98975c4cc054f98fd7cb14b7e8fb7 (diff)
downloadHydroRollCore-14368e5a7bdcc4b6d3b151ecd9cb3162c30f292e.tar.gz
HydroRollCore-14368e5a7bdcc4b6d3b151ecd9cb3162c30f292e.zip
refactor: Comment hook function while running the rules packages
TODO: builtin hook function in every rules packages.
Diffstat (limited to 'hrc/core.py')
-rw-r--r--hrc/core.py41
1 files changed, 22 insertions, 19 deletions
diff --git a/hrc/core.py b/hrc/core.py
index 3d19b46..35f613d 100644
--- a/hrc/core.py
+++ b/hrc/core.py
@@ -158,31 +158,34 @@ class Core:
await core_run_hook_func(self)
try:
- for _rule in self.rules:
- for rule_enable_hook_func in self._rule_enable_hooks:
- await rule_enable_hook_func(_rule)
- try:
- await _rule.enable()
- except Exception as e:
- self.error_or_exception(
- f"Enable rule {_rule!r} failed:", e)
-
- for _rule in self.rules:
- for rule_run_hook_func in self._rule_run_hooks:
- await rule_run_hook_func(_rule)
- _rule_task = asyncio.create_task(_rule.safe_run())
- self._rule_tasks.add(_rule_task)
- _rule_task.add_done_callback(self._rule_tasks.discard)
+ ##########################################################
+ # @TODO: builtin hook function in every rules packages.
+ ##########################################################
+ # for _rule in self.rules:
+ # for rule_enable_hook_func in self._rule_enable_hooks:
+ # await rule_enable_hook_func(_rule)
+ # try:
+ # await _rule.enable()
+ # except Exception as e:
+ # self.error_or_exception(
+ # f"Enable rule {_rule!r} failed:", e)
+
+ # for _rule in self.rules:
+ # for rule_run_hook_func in self._rule_run_hooks:
+ # await rule_run_hook_func(_rule)
+ # _rule_task = asyncio.create_task(_rule.safe_run())
+ # self._rule_tasks.add(_rule_task)
+ # _rule_task.add_done_callback(self._rule_tasks.discard)
await self.should_exit.wait()
if hot_reload_task is not None: # pragma: no cover
await hot_reload_task
finally:
- for _rule in self.rules:
- for rule_disable_hook_func in self._rule_disable_hooks:
- await rule_disable_hook_func(_rule)
- await _rule.disable()
+ # for _rule in self.rules:
+ # for rule_disable_hook_func in self._rule_disable_hooks:
+ # await rule_disable_hook_func(_rule)
+ # await _rule.disable()
while self._rule_tasks:
await asyncio.sleep(0)