From 06e07dc86510efb92ff78c1e052bbfd601c90a87 Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 7 Nov 2017 01:50:44 -0500 Subject: [PATCH] Converted appropriate waits to gathers for ease of use with exceptions --- src/main/cogs/booru.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/cogs/booru.py b/src/main/cogs/booru.py index 8ecf07a..32f96fc 100644 --- a/src/main/cogs/booru.py +++ b/src/main/cogs/booru.py @@ -681,10 +681,8 @@ class MsG: while not self.bot.is_closed(): try: - done, pending = await asyncio.wait([self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), - self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)], return_when=asyncio.FIRST_COMPLETED) - for future in done: - future.result() + await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), + self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)]) except exc.Save: if values[c - 1]['url'] not in hearted: @@ -824,10 +822,8 @@ class MsG: while not self.bot.is_closed(): try: - done, pending = await asyncio.wait([self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), - self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)], return_when=asyncio.FIRST_COMPLETED) - for future in done: - future.result() + await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), + self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)]) except exc.Save: if values[c - 1]['url'] not in hearted: @@ -990,10 +986,8 @@ class MsG: while not self.bot.is_closed(): try: - done, pending = await asyncio.wait([self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), - self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)], return_when=asyncio.FIRST_COMPLETED) - for future in done: - future.result() + await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=10 * 60), + self.bot.wait_for('reaction_remove', check=on_reaction, timeout=10 * 60)]) except exc.Save: if values[c - 1]['url'] not in hearted: