diff --git a/brewtils/request_handling.py b/brewtils/request_handling.py index b59205fa..ebc860ad 100644 --- a/brewtils/request_handling.py +++ b/brewtils/request_handling.py @@ -54,10 +54,13 @@ def process_command(self, request): Any """ - parent_request = copy.deepcopy(brewtils.plugin.request_context.current_request) + parent_request = copy.deepcopy(getattr( + brewtils.plugin.request_context, "current_request", None + )) - request.parent = Request(id=str(parent_request.id)) - request.has_parent = True + if parent_request: + request.parent = Request(id=str(parent_request.id)) + request.has_parent = True request.status = "IN_PROGRESS" diff --git a/brewtils/rest/system_client.py b/brewtils/rest/system_client.py index 561fda82..d41cd78b 100644 --- a/brewtils/rest/system_client.py +++ b/brewtils/rest/system_client.py @@ -424,10 +424,7 @@ def send_bg_request(self, *args, **kwargs): # If not blocking just return the future if not blocking: - # TODO: Investigate if self targeting requests with no parents can be processed locally - if not self.target_self or not getattr( - brewtils.plugin.request_context, "current_request", None - ): + if not self.target_self: return self._thread_pool.submit( self._wait_for_request, request, raise_on_error, timeout )