From 836ae979cbe2663de77e7cf49899a603a70f7df0 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Thu, 27 Jul 2017 20:50:27 -0700 Subject: [PATCH] adjust connection rate --- pnut-bridge.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pnut-bridge.py b/pnut-bridge.py index c032f74..72a9cbb 100644 --- a/pnut-bridge.py +++ b/pnut-bridge.py @@ -109,6 +109,7 @@ class ChannelMonitor(threading.Thread): def poll_channel(self, room): try: r = Pnut(app.config['MATRIX_PNUT_TOKEN']).get_channel_stream(room.pnut_chan, room.pnut_since) + # print(r.headers['X-RateLimit-Remaining'], r.headers['X-RateLimit-Reset']) except requests.exceptions.ConnectionError: logging.info('*** Problem connecting to pnut.io! Waiting to retry. ***') time.sleep(30) @@ -187,7 +188,8 @@ class ChannelMonitor(threading.Thread): rooms = MatrixRoom2.query.all() for r in rooms: self.poll_channel(r) - time.sleep(15) + time.sleep(1) + time.sleep(1.5) logging.info("-- Stopping channel monitor --") if __name__ == '__main__':