Skip to content

Commit 2fc1fda

Browse files
committed
Remove unused run_before_tasks
1 parent f7236b1 commit 2fc1fda

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
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
- Apply rate limiting to regex hooks
2121
- Ensure event order is deterministic
2222
### Fixed
23+
- Ensure event order is deterministic
2324
- Fix matching exception in horoscope test
2425
- Fix youtube.py ISO time parse
2526
- Fix grammatical error in food sentence (beer)
@@ -34,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3435
- metacritic.py removed due to broken scraper and lack of maintainer
3536
- amazon.py removed due to broken scraper and no maintainer
3637
- newegg.py removed due to broken scraper and no maintainer
38+
- Remove unused run_before events/tasks
3739

3840
## [1.3.0] 2020-03-17
3941
### Added

cloudbot/bot.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,10 @@ async def process(self, event):
311311
"""
312312
:type event: Event
313313
"""
314-
run_before_tasks = []
315314
tasks = []
316315
halted = False
317316

318-
def add_hook(hook, _event, _run_before=False):
317+
def add_hook(hook, _event):
319318
nonlocal halted
320319
if halted:
321320
return False
@@ -324,10 +323,7 @@ def add_hook(hook, _event, _run_before=False):
324323
return True
325324

326325
coro = self.plugin_manager.launch(hook, _event)
327-
if _run_before:
328-
run_before_tasks.append(coro)
329-
else:
330-
tasks.append(coro)
326+
tasks.append(coro)
331327

332328
if hook.action is Action.HALTALL:
333329
halted = True
@@ -340,10 +336,8 @@ def add_hook(hook, _event, _run_before=False):
340336

341337
# Raw IRC hook
342338
for raw_hook in self.plugin_manager.catch_all_triggers:
343-
# run catch-all coroutine hooks before all others - TODO: Make this a plugin argument
344-
run_before = not raw_hook.threaded
345339
if not add_hook(
346-
raw_hook, Event(hook=raw_hook, base_event=event), _run_before=run_before
340+
raw_hook, Event(hook=raw_hook, base_event=event)
347341
):
348342
# The hook has an action of Action.HALT* so stop adding new tasks
349343
break
@@ -424,5 +418,4 @@ def add_hook(hook, _event, _run_before=False):
424418
break
425419

426420
# Run the tasks
427-
await asyncio.gather(*run_before_tasks, loop=self.loop)
428421
await asyncio.gather(*tasks, loop=self.loop)

0 commit comments

Comments
 (0)