changeset 234:fd29ae905d1b

Fixed some warnings
author Matt Johnston <matt@ucc.asn.au>
date Tue, 28 Apr 2015 22:44:10 +0800
parents 19569cb5ed46
children 4cbcbba567ab
files py/tempserver.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/py/tempserver.py	Sat Apr 11 23:32:59 2015 +0800
+++ b/py/tempserver.py	Tue Apr 28 22:44:10 2015 +0800
@@ -48,21 +48,19 @@
 
         # XXX do these go here or in __enter_() ?
         self.start_time = self.now()
-        tasks = (
+        runloops = [
             self.fridge.run(),
             self.sensors.run(),
             self.uploader.run(),
-        )
+        ]
 
         loop = asyncio.get_event_loop()
         try:
-            result_tasks = loop.run_until_complete(asyncio.wait(tasks, return_when=asyncio.FIRST_EXCEPTION))
-            # use the results so that exceptions get thrown
-            [t.result() for x in result_tasks for t in x]
+            loop.run_until_complete(asyncio.gather(*runloops))
         except KeyboardInterrupt:
-            print('ctrl-c')
-            pass
+            print('\nctrl-c')
         finally:
+            # loop.close() seems necessary otherwise get warnings about signal handlers
             loop.close()
 
     def now(self):
@@ -110,7 +108,7 @@
             yield from asyncio.wait_for(self._wakeup.wait(), timeout=timeout)
         except asyncio.TimeoutError:
             pass
-        
+
     def _reload_signal(self):
         try:
             self.params.load()