From 64c9a5de92934a1f779a747123f433bb2c7e1bcf Mon Sep 17 00:00:00 2001 From: schneefux Date: Wed, 8 Feb 2017 18:56:30 +0100 Subject: tolerate connection errors --- api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api.py b/api.py index 9e5a8d7..7843f12 100644 --- a/api.py +++ b/api.py @@ -34,9 +34,14 @@ async def crawl_region(region): region, last_match_update) # wait for http requests - matches = await api.matches_since(last_match_update, - region=region, - params={"page[limit]": 50}) + try: + matches = await api.matches_since(last_match_update, + region=region, + params={"page[limit]": 50}) + except: + logging.error("%s: connection error, retrying", region) + await asyncio.sleep(5) + if len(matches) > 0: logging.debug("%s: %s objects", region, len(matches)) else: -- cgit v1.3.1