fix for deleted servers
This commit is contained in:
parent
8e97808ef0
commit
c2542b0840
@ -77,8 +77,9 @@ class Poll:
|
|||||||
|
|
||||||
async def is_open(self, update_db=True):
|
async def is_open(self, update_db=True):
|
||||||
if self.server is None:
|
if self.server is None:
|
||||||
|
self.open = True
|
||||||
return
|
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():
|
and datetime.datetime.utcnow().replace(tzinfo=pytz.utc) > self.get_duration_with_tz():
|
||||||
self.open = False
|
self.open = False
|
||||||
if update_db:
|
if update_db:
|
||||||
@ -87,6 +88,7 @@ class Poll:
|
|||||||
|
|
||||||
async def is_active(self, update_db=True):
|
async def is_active(self, update_db=True):
|
||||||
if self.server is None:
|
if self.server is None:
|
||||||
|
self.active = False
|
||||||
return
|
return
|
||||||
if not self.active and self.activation != 0 \
|
if not self.active and self.activation != 0 \
|
||||||
and datetime.datetime.utcnow().replace(tzinfo=pytz.utc) > self.get_activation_with_tz():
|
and datetime.datetime.utcnow().replace(tzinfo=pytz.utc) > self.get_activation_with_tz():
|
||||||
|
|||||||
@ -59,9 +59,10 @@ class PollControls:
|
|||||||
logger.warning("Attribute Error in close_polls loop")
|
logger.warning("Attribute Error in close_polls loop")
|
||||||
logger.exception(ae)
|
logger.exception(ae)
|
||||||
pass
|
pass
|
||||||
except:
|
except Exception as ex:
|
||||||
#Never break this loop due to an error
|
#Never break this loop due to an error
|
||||||
logger.error("Other Error in close_polls loop")
|
logger.error("Other Error in close_polls loop")
|
||||||
|
logger.exception(ex)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
await asyncio.sleep(30)
|
await asyncio.sleep(30)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user