From a29fc499021f979f72ed370ad8081c76f2f9d537 Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Thu, 30 Jan 2020 15:23:48 -0800 Subject: [PATCH] Fix LoadComposableNodes action so that loading happens asynchronously (#113) Fixes #107. Before, the first call to _load_in_sequence was not asynchronous, unlike it's recursive calls. This change makes the first call asynchronous. Signed-off-by: Jacob Perron --- launch_ros/launch_ros/actions/load_composable_nodes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/launch_ros/launch_ros/actions/load_composable_nodes.py b/launch_ros/launch_ros/actions/load_composable_nodes.py index 1cf87636..4b07092f 100644 --- a/launch_ros/launch_ros/actions/load_composable_nodes.py +++ b/launch_ros/launch_ros/actions/load_composable_nodes.py @@ -167,5 +167,9 @@ def execute( self.__target_container.node_name ) ) - # Assume user has configured `LoadComposableNodes` to happen after container action - self._load_in_sequence(self.__composable_node_descriptions, context) + + context.add_completion_future( + context.asyncio_loop.run_in_executor( + None, self._load_in_sequence, self.__composable_node_descriptions, context + ) + )