|
5 | 5 |
|
6 | 6 | from datetime import timedelta |
7 | 7 | import azure.functions as func |
8 | | -from urllib.parse import urlparse, urljoin, quote |
| 8 | +from urllib.parse import urlparse, quote |
9 | 9 |
|
10 | 10 | from durabletask.client import TaskHubGrpcClient |
11 | 11 | from .internal.azurefunctions_grpc_interceptor import AzureFunctionsDefaultClientInterceptorImpl |
12 | 12 | from .http import HttpManagementPayload |
13 | | -import requests |
14 | 13 |
|
15 | 14 |
|
16 | 15 | # Client class used for Durable Functions |
@@ -44,10 +43,6 @@ def __init__(self, client_as_string: str): |
44 | 43 | json.JSONDecodeError: If the provided string is not valid JSON. |
45 | 44 | """ |
46 | 45 | self._parse_client_configuration(client_as_string) |
47 | | - if not self.httpBaseUrl: |
48 | | - # This happens when the extension has not been configured for gRPC yet. For some reason, instead of |
49 | | - # the client returning with null rpcBaseUrl and httpBaseUrl, it returns rpcBaseUrl with the http url. |
50 | | - self.configure_extension_for_grpc() |
51 | 46 |
|
52 | 47 | interceptors = [AzureFunctionsDefaultClientInterceptorImpl(self.taskHubName, self.requiredQueryStringParameters)] |
53 | 48 |
|
@@ -82,31 +77,6 @@ def _parse_client_configuration(self, client_as_string: str) -> None: |
82 | 77 | # TODO: convert the string value back to timedelta - annoying regex? |
83 | 78 | self.grpcHttpClientTimeout = client.get("grpcHttpClientTimeout", timedelta(seconds=30)) |
84 | 79 |
|
85 | | - def configure_extension_for_grpc(self) -> None: |
86 | | - """Configures the Durable Functions extension for gRPC communication. |
87 | | -
|
88 | | - Makes an HTTP request to the extension's management endpoint to enable gRPC. |
89 | | - """ |
90 | | - |
91 | | - # Make an HTTP request to the extension to configure gRPC |
92 | | - configure_base_url = self.httpBaseUrl |
93 | | - if not configure_base_url: |
94 | | - # For some reason, in the "bad" case when rpc has not been configured, the httpBaseUrl is empty and sent in rpcBaseUrl |
95 | | - configure_base_url = self.rpcBaseUrl |
96 | | - # configure_base_url = urlparse(configure_base_url) |
97 | | - # url = f"{configure_base_url.scheme}://{configure_base_url.netloc}/management/configureGrpc" |
98 | | - url = urljoin(configure_base_url, "management/configureGrpc") |
99 | | - params = { |
100 | | - "taskHubName": self.taskHubName, |
101 | | - "connectionName": self.connectionName |
102 | | - } |
103 | | - response = requests.get(url, params=params) |
104 | | - if response.status_code != 200: |
105 | | - raise Exception(f"Failed to configure gRPC for Durable Functions extension. Status code: {response.status_code}, Response: {response.text}") |
106 | | - |
107 | | - # Parse the response to update client configuration - it's double-encoded so we need to load it twice |
108 | | - self._parse_client_configuration(json.loads(response.text)) |
109 | | - |
110 | 80 | def create_check_status_response(self, request: func.HttpRequest, instance_id: str) -> func.HttpResponse: |
111 | 81 | """Creates an HTTP response for checking the status of a Durable Function instance. |
112 | 82 |
|
|
0 commit comments