Skip to content

Commit e6c8a88

Browse files
committed
Remove unused run_before_tasks
1 parent 22105b7 commit e6c8a88

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- Apply rate limiting to regex hooks
1919
- Ensure event order is deterministic
2020
### Fixed
21+
- Ensure event order is deterministic
2122
- Fix matching exception in horoscope test
2223
- Fix youtube.py ISO time parse
2324
- Fix grammatical error in food sentence (beer)
@@ -27,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2728
- Fix FML random URL
2829
### Removed
2930
- twitch.py removed due to outdated API and lack of maintainer
31+
- Remove unused run_before events/tasks
3032

3133
## [1.3.0] 2020-03-17
3234
### 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)