File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
23
23
- Update mylife.py for website changes
24
24
- Fixed handling of colons in core IRC parser
25
25
- Fix FML random URL
26
+ - Ensure hooks are triggered according to priority
26
27
### Removed
27
28
- twitch.py removed due to outdated API and lack of maintainer
28
29
- Remove unused run_before events/tasks
Original file line number Diff line number Diff line change @@ -311,8 +311,7 @@ def add_hook(hook, _event):
311
311
if hook .clients and _event .conn .type not in hook .clients :
312
312
return True
313
313
314
- coro = self .plugin_manager .launch (hook , _event )
315
- tasks .append (coro )
314
+ tasks .append ((hook , _event ))
316
315
317
316
if hook .action is Action .HALTALL :
318
317
halted = True
@@ -396,5 +395,10 @@ def add_hook(hook, _event):
396
395
# The hook has an action of Action.HALT* so stop adding new tasks
397
396
break
398
397
398
+ tasks .sort (key = lambda t : t [0 ].priority )
399
+
399
400
# Run the tasks
400
- await asyncio .gather (* tasks , loop = self .loop )
401
+ await asyncio .gather (* [
402
+ asyncio .ensure_future (self .plugin_manager .launch (hook , _event ))
403
+ for hook , _event in tasks
404
+ ], loop = self .loop )
You can’t perform that action at this time.
0 commit comments