diff --git a/pnut-bridge.py b/pnut-bridge.py index 51f7af5..c032f74 100644 --- a/pnut-bridge.py +++ b/pnut-bridge.py @@ -107,7 +107,16 @@ class ChannelMonitor(threading.Thread): db.session.commit() def poll_channel(self, room): - r = Pnut(app.config['MATRIX_PNUT_TOKEN']).get_channel_stream(room.pnut_chan, room.pnut_since) + try: + 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: rdata = r.json() pqueue = []