Skip to content

Commit 0f76506

Browse files
committed
Remove unused run_before_tasks
1 parent 91f2f80 commit 0f76506

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Change user lookup logic in last.fm plugin
1515
- Refactor minecraft_ping plugin for updated mcstatus library
1616
- Expand youtube.py error information
17-
- Ensure event order is deterministic
1817
### Fixed
18+
- Ensure event order is deterministic
1919
- Fix matching exception in horoscope test
2020
- Fix youtube.py ISO time parse
2121
- Fix grammatical error in food sentence (beer)
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- Fix FML random URL
2626
### Removed
2727
- twitch.py removed due to outdated API and lack of maintainer
28+
- Remove unused run_before events/tasks
2829

2930
## [1.3.0] 2020-03-17
3031
### Added

cloudbot/bot.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,10 @@ async def process(self, event):
300300
"""
301301
:type event: Event
302302
"""
303-
run_before_tasks = []
304303
tasks = []
305304
halted = False
306305

307-
def add_hook(hook, _event, _run_before=False):
306+
def add_hook(hook, _event):
308307
nonlocal halted
309308
if halted:
310309
return False
@@ -313,10 +312,7 @@ def add_hook(hook, _event, _run_before=False):
313312
return True
314313

315314
coro = self.plugin_manager.launch(hook, _event)
316-
if _run_before:
317-
run_before_tasks.append(coro)
318-
else:
319-
tasks.append(coro)
315+
tasks.append(coro)
320316

321317
if hook.action is Action.HALTALL:
322318
halted = True
@@ -329,9 +325,7 @@ def add_hook(hook, _event, _run_before=False):
329325

330326
# Raw IRC hook
331327
for raw_hook in self.plugin_manager.catch_all_triggers:
332-
# run catch-all coroutine hooks before all others - TODO: Make this a plugin argument
333-
run_before = not raw_hook.threaded
334-
if not add_hook(raw_hook, Event(hook=raw_hook, base_event=event), _run_before=run_before):
328+
if not add_hook(raw_hook, Event(hook=raw_hook, base_event=event)):
335329
# The hook has an action of Action.HALT* so stop adding new tasks
336330
break
337331

@@ -403,5 +397,4 @@ def add_hook(hook, _event, _run_before=False):
403397
break
404398

405399
# Run the tasks
406-
await asyncio.gather(*run_before_tasks, loop=self.loop)
407400
await asyncio.gather(*tasks, loop=self.loop)

0 commit comments

Comments
 (0)