Mercurial > templog
diff py/configwaiter.py @ 299:358c50004679
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 27 Feb 2017 23:20:07 +0800 |
parents | 78c542f03030 |
children |
line wrap: on
line diff
--- a/py/configwaiter.py Mon Feb 20 23:23:57 2017 +0800 +++ b/py/configwaiter.py Mon Feb 27 23:20:07 2017 +0800 @@ -1,4 +1,6 @@ import asyncio +import datetime + import aiohttp import utils @@ -12,6 +14,7 @@ self.server = server self.epoch_tag = None self.http_session = aiohttp.ClientSession() + self.limitlog = utils.NotTooOften(datetime.timedelta(minutes=15)) @asyncio.coroutine def run(self): @@ -49,14 +52,13 @@ pass else: # longer timeout to avoid spinning + text = yield from asyncio.wait_for(r.text(), 600) + D("Bad server response. %d %s" % (r.status, text)) yield from asyncio.sleep(30) - except asyncio.TimeoutError: - D("configwaiter http timed out") - pass + except aiohttp.errors.ClientError as e: + self.limitlog.log("Error with configwaiter: %s" % str(e)) + except asyncio.TimeoutError as e: + self.limitlog.log("configwaiter http timed out: %s" % str(e)) except Exception as e: EX("Error watching config: %s" % str(e)) - - - -