fix for deleted servers

This commit is contained in:
Matthias Nadler 2019-03-23 12:17:17 +01:00
parent 8e97808ef0
commit c2542b0840
2 changed files with 5 additions and 2 deletions

View File

@ -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():

View File

@ -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)