diff py/uploader.py @ 259:26eee8591f61

long polling works
author Matt Johnston <matt@ucc.asn.au>
date Tue, 09 Jun 2015 23:27:44 +0800
parents 6d06795aefbb
children 78c542f03030 d15dda1b1f76
line wrap: on
line diff
--- a/py/uploader.py	Mon Jun 08 22:33:04 2015 +0800
+++ b/py/uploader.py	Tue Jun 09 23:27:44 2015 +0800
@@ -22,7 +22,7 @@
         yield from asyncio.sleep(5)
         while True:
             yield from self.do()
-            yield from self.server.sleep(config.UPLOAD_SLEEP)
+            yield from asyncio.sleep(config.UPLOAD_SLEEP)
 
     def get_tosend(self, readings):
         tosend = {}
@@ -62,12 +62,13 @@
         try:
             readings = self.server.take_readings()
             tosend = self.get_tosend(readings)
+            D("tosend >>>%s<<<" % str(tosend))
             nreadings = len(readings)
             yield from self.send(tosend)
             readings = None
             D("Sent updated %d readings" % nreadings)
         except Exception as e:
-            E("Error in uploader: %s" % str(e))
+            EX("Error in uploader: %s" % str(e))
         finally:
             if readings is not None:
                 self.server.pushfront(readings)