perf: fast path for sync hooks

This commit is contained in:
Maximilian Hils 2022-02-04 16:05:52 +01:00
parent 6dc6269b8e
commit 068204fc59

View File

@ -264,7 +264,7 @@ class AddonManager:
for addon, func in self._iter_hooks(addon, event): for addon, func in self._iter_hooks(addon, event):
res = func(*event.args()) res = func(*event.args())
# Support both async and sync hook functions # Support both async and sync hook functions
if inspect.isawaitable(res): if res is not None and inspect.isawaitable(res):
await res await res
def invoke_addon_sync(self, addon, event: hooks.Hook): def invoke_addon_sync(self, addon, event: hooks.Hook):