Mercurial > templog
diff py/uploader.py @ 253:0a1b642e3086
long polling config updates
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 08 Jun 2015 22:29:46 +0800 |
parents | 86e638d564b0 |
children | 6d06795aefbb |
line wrap: on
line diff
--- a/py/uploader.py Wed May 27 23:46:06 2015 +0800 +++ b/py/uploader.py Mon Jun 08 22:29:46 2015 +0800 @@ -36,6 +36,7 @@ tosend['fridge_name'] = self.server.wort_name tosend['current_params'] = dict(self.server.params) + tosend['current_params_epoch'] = self.server.params.get_epoch() tosend['start_time'] = self.server.start_time tosend['uptime'] = utils.uptime() @@ -53,7 +54,7 @@ send_data = {'data': js_enc.decode(), 'hmac': mac} r = yield from asyncio.wait_for(aiohttp.request('post', config.UPDATE_URL, data=send_data), 60) result = yield from asyncio.wait_for(r.text(), 60) - if result != 'OK': + if r.status == 200 and result != 'OK': raise Exception("Server returned %s" % result) @asyncio.coroutine