From 980f5afd19aea6395562e0f05a3bafdc33a472b8 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Sat, 30 Nov 2019 22:58:03 -0600 Subject: [PATCH] Remove unused run_before_tasks --- CHANGELOG.md | 3 ++- cloudbot/bot.py | 13 +++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b87322458..133ae9c8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,8 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Change user lookup logic in last.fm plugin - Refactor minecraft_ping plugin for updated mcstatus library - Expand youtube.py error information -- Ensure event order is deterministic ### Fixed +- Ensure event order is deterministic - Fix matching exception in horoscope test - Fix youtube.py ISO time parse - 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 - Fix FML random URL ### Removed - twitch.py removed due to outdated API and lack of maintainer +- Remove unused run_before events/tasks ## [1.3.0] 2020-03-17 ### Added diff --git a/cloudbot/bot.py b/cloudbot/bot.py index 003faf781..61aea60fc 100644 --- a/cloudbot/bot.py +++ b/cloudbot/bot.py @@ -300,11 +300,10 @@ async def process(self, event): """ :type event: Event """ - run_before_tasks = [] tasks = [] halted = False - def add_hook(hook, _event, _run_before=False): + def add_hook(hook, _event): nonlocal halted if halted: return False @@ -313,10 +312,7 @@ def add_hook(hook, _event, _run_before=False): return True coro = self.plugin_manager.launch(hook, _event) - if _run_before: - run_before_tasks.append(coro) - else: - tasks.append(coro) + tasks.append(coro) if hook.action is Action.HALTALL: halted = True @@ -329,9 +325,7 @@ def add_hook(hook, _event, _run_before=False): # Raw IRC hook for raw_hook in self.plugin_manager.catch_all_triggers: - # run catch-all coroutine hooks before all others - TODO: Make this a plugin argument - run_before = not raw_hook.threaded - if not add_hook(raw_hook, Event(hook=raw_hook, base_event=event), _run_before=run_before): + if not add_hook(raw_hook, Event(hook=raw_hook, base_event=event)): # The hook has an action of Action.HALT* so stop adding new tasks break @@ -403,5 +397,4 @@ def add_hook(hook, _event, _run_before=False): break # Run the tasks - await asyncio.gather(*run_before_tasks, loop=self.loop) await asyncio.gather(*tasks, loop=self.loop)