mirror of https://github.com/m-labs/artiq.git
use recommended asyncio.ensure_future instead of asyncio.Task
This commit is contained in:
parent
a46d3ff366
commit
114b305203
|
@ -30,7 +30,7 @@ class Controller:
|
||||||
self.retry_timer_cur = self.retry_timer
|
self.retry_timer_cur = self.retry_timer
|
||||||
self.retry_now = Condition()
|
self.retry_now = Condition()
|
||||||
self.process = None
|
self.process = None
|
||||||
self.launch_task = asyncio.Task(self.launcher())
|
self.launch_task = asyncio.ensure_future(self.launcher())
|
||||||
|
|
||||||
async def end(self):
|
async def end(self):
|
||||||
self.launch_task.cancel()
|
self.launch_task.cancel()
|
||||||
|
@ -160,7 +160,7 @@ class Controllers:
|
||||||
self.active_or_queued = set()
|
self.active_or_queued = set()
|
||||||
self.queue = asyncio.Queue()
|
self.queue = asyncio.Queue()
|
||||||
self.active = dict()
|
self.active = dict()
|
||||||
self.process_task = asyncio.Task(self._process())
|
self.process_task = asyncio.ensure_future(self._process())
|
||||||
|
|
||||||
async def _process(self):
|
async def _process(self):
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Subscriber:
|
||||||
before_receive_cb()
|
before_receive_cb()
|
||||||
self.writer.write(_init_string)
|
self.writer.write(_init_string)
|
||||||
self.writer.write((self.notifier_name + "\n").encode())
|
self.writer.write((self.notifier_name + "\n").encode())
|
||||||
self.receive_task = asyncio.Task(self._receive_cr())
|
self.receive_task = asyncio.ensure_future(self._receive_cr())
|
||||||
except:
|
except:
|
||||||
self.writer.close()
|
self.writer.close()
|
||||||
del self.reader
|
del self.reader
|
||||||
|
|
Loading…
Reference in New Issue