From c2542b084097f8aab5bb4fb4865d95e2c6cdf2f3 Mon Sep 17 00:00:00 2001 From: Matthias Nadler Date: Sat, 23 Mar 2019 12:17:17 +0100 Subject: [PATCH] fix for deleted servers --- cogs/poll.py | 4 +++- cogs/poll_controls.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cogs/poll.py b/cogs/poll.py index 7ccee57..e46c2f9 100644 --- a/cogs/poll.py +++ b/cogs/poll.py @@ -77,8 +77,9 @@ class Poll: async def is_open(self, update_db=True): if self.server is None: + self.open = True return - if open and self.duration != 0 \ + if self.open and self.duration != 0 \ and datetime.datetime.utcnow().replace(tzinfo=pytz.utc) > self.get_duration_with_tz(): self.open = False if update_db: @@ -87,6 +88,7 @@ class Poll: async def is_active(self, update_db=True): if self.server is None: + self.active = False return if not self.active and self.activation != 0 \ and datetime.datetime.utcnow().replace(tzinfo=pytz.utc) > self.get_activation_with_tz(): diff --git a/cogs/poll_controls.py b/cogs/poll_controls.py index 11a9b34..7d8bb4a 100644 --- a/cogs/poll_controls.py +++ b/cogs/poll_controls.py @@ -59,9 +59,10 @@ class PollControls: logger.warning("Attribute Error in close_polls loop") logger.exception(ae) pass - except: + except Exception as ex: #Never break this loop due to an error logger.error("Other Error in close_polls loop") + logger.exception(ex) pass await asyncio.sleep(30)