changeset 554:39540ddacdca

put more things inside "try"
author Matt Johnston <matt@ucc.asn.au>
date Mon, 08 Jun 2015 22:31:21 +0800
parents 92632a6d1dc6
children 9dea75bd765f
files py/fridge.py py/uploader.py
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/py/fridge.py	Wed May 20 23:10:37 2015 +0800
+++ b/py/fridge.py	Mon Jun 08 22:31:21 2015 +0800
@@ -35,8 +35,8 @@
         if self.server.params.disabled:
             L("Fridge is disabled")
         while True:
-            self.do()
             try:
+                self.do()
                 yield from self.server.sleep(config.FRIDGE_SLEEP)
             except Exception as e:
                 EX("fridge failed")
@@ -111,7 +111,7 @@
         else:
             # fridge is off
             turn_on = False
-            D("fridge %(fridge)f max %(fridge_max)f wort %(wort)f wort_max %(wort_max)f" % locals())
+            D("fridge %(fridge)s max %(fridge_max)s wort %(wort)s wort_max %(wort_max)s" % locals())
             if not params.nowort \
                 and wort is not None \
                 and wort >= wort_max:
--- a/py/uploader.py	Wed May 20 23:10:37 2015 +0800
+++ b/py/uploader.py	Mon Jun 08 22:31:21 2015 +0800
@@ -58,8 +58,8 @@
 
     @asyncio.coroutine
     def do(self):
-        readings = self.server.take_readings()
         try:
+            readings = self.server.take_readings()
             tosend = self.get_tosend(readings)
             nreadings = len(readings)
             yield from self.send(tosend)