forked from M-Labs/artiq
aqctl_corelog: fix asyncio loop management
This commit is contained in:
parent
628b671433
commit
f8d93813e9
|
@ -96,14 +96,15 @@ def main():
|
||||||
signal_handler.setup()
|
signal_handler.setup()
|
||||||
try:
|
try:
|
||||||
get_logs_task = asyncio.ensure_future(
|
get_logs_task = asyncio.ensure_future(
|
||||||
get_logs_sim(args.core_addr) if args.simulation else get_logs(args.core_addr))
|
get_logs_sim(args.core_addr) if args.simulation else get_logs(args.core_addr),
|
||||||
|
loop=loop)
|
||||||
try:
|
try:
|
||||||
server = Server({"corelog": PingTarget()}, None, True)
|
server = Server({"corelog": PingTarget()}, None, True)
|
||||||
loop.run_until_complete(server.start(common_args.bind_address_from_args(args), args.port))
|
loop.run_until_complete(server.start(common_args.bind_address_from_args(args), args.port))
|
||||||
try:
|
try:
|
||||||
_, pending = loop.run_until_complete(asyncio.wait(
|
_, pending = loop.run_until_complete(asyncio.wait(
|
||||||
[signal_handler.wait_terminate(),
|
[loop.create_task(signal_handler.wait_terminate()),
|
||||||
server.wait_terminate(),
|
loop.create_task(server.wait_terminate()),
|
||||||
get_logs_task],
|
get_logs_task],
|
||||||
return_when=asyncio.FIRST_COMPLETED))
|
return_when=asyncio.FIRST_COMPLETED))
|
||||||
for task in pending:
|
for task in pending:
|
||||||
|
|
Loading…
Reference in New Issue