mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 18:03:50 +00:00
perf: fast path for sync hooks
This commit is contained in:
parent
6dc6269b8e
commit
068204fc59
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user