Skip to content

Commit

Permalink
Allow None for current request
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog authored Jan 26, 2024
1 parent d6cf161 commit 8bcc529
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 6 additions & 3 deletions brewtils/request_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
5 changes: 1 addition & 4 deletions brewtils/rest/system_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 8bcc529

Please sign in to comment.