attempt to handle connection error to pnut, issue #13

This commit is contained in:
Morgan McMillian 2017-07-16 06:40:23 -07:00
parent 76e1c15b69
commit 0201c904fa

View file

@ -107,7 +107,16 @@ class ChannelMonitor(threading.Thread):
db.session.commit() db.session.commit()
def poll_channel(self, room): def poll_channel(self, room):
try:
r = Pnut(app.config['MATRIX_PNUT_TOKEN']).get_channel_stream(room.pnut_chan, room.pnut_since) r = Pnut(app.config['MATRIX_PNUT_TOKEN']).get_channel_stream(room.pnut_chan, room.pnut_since)
except requests.exceptions.ConnectionError:
logging.info('*** Problem connecting to pnut.io! Waiting to retry. ***')
time.sleep(30)
return
except:
logging.info('*** Registered some other error! Waiting to retry. ***')
time.sleep(30)
return
if r is not None and r.status_code == 200: if r is not None and r.status_code == 200:
rdata = r.json() rdata = r.json()
pqueue = [] pqueue = []