Skip to content

Commit b0bacf0

Browse files
Moving and adding default value to var (#1494)
Co-authored-by: wangbill <[email protected]>
1 parent cd13c6a commit b0bacf0

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

azure_functions_worker/dispatcher.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ async def _handle__invocation_request(self, request):
525525
invoc_request = request.invocation_request
526526
invocation_id = invoc_request.invocation_id
527527
function_id = invoc_request.function_id
528+
http_v2_enabled = False
528529

529530
# Set the current `invocation_id` to the current task so
530531
# that our logging handler can find it.
@@ -555,6 +556,10 @@ async def _handle__invocation_request(self, request):
555556

556557
args = {}
557558

559+
http_v2_enabled = self._functions.get_function(function_id) \
560+
.is_http_func and \
561+
HttpV2Registry.http_v2_enabled()
562+
558563
for pb in invoc_request.input_data:
559564
pb_type_info = fi.input_types[pb.name]
560565
if bindings.is_trigger_binding(pb_type_info.binding_name):
@@ -570,10 +575,6 @@ async def _handle__invocation_request(self, request):
570575
shmem_mgr=self._shmem_mgr,
571576
is_deferred_binding=pb_type_info.deferred_bindings_enabled)
572577

573-
http_v2_enabled = self._functions.get_function(function_id) \
574-
.is_http_func and \
575-
HttpV2Registry.http_v2_enabled()
576-
577578
if http_v2_enabled:
578579
http_request = await http_coordinator.get_http_request_async(
579580
invocation_id)

tests/extension_tests/deferred_bindings_tests/deferred_bindings_blob_functions/function_app.py

+10
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,13 @@ def put_blob_bytes(req: func.HttpRequest, file: func.Out[bytes]) -> str:
257257
def blob_cache(req: func.HttpRequest,
258258
client: blob.BlobClient) -> str:
259259
return client.download_blob(encoding='utf-8').readall()
260+
261+
262+
@app.function_name(name="invalid_connection_info")
263+
@app.blob_input(arg_name="client",
264+
path="python-worker-tests/test-blobclient-triggered.txt",
265+
connection="NotARealConnectionString")
266+
@app.route(route="invalid_connection_info")
267+
def invalid_connection_info(req: func.HttpRequest,
268+
client: blob.BlobClient) -> str:
269+
return client.download_blob(encoding='utf-8').readall()

tests/extension_tests/deferred_bindings_tests/test_deferred_bindings_blob_functions.py

+6
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,9 @@ def test_caching(self):
179179

180180
r = self.webhost.request('GET', 'blob_cache')
181181
self.assertEqual(r.status_code, 200)
182+
183+
def test_failed_client_creation(self):
184+
r = self.webhost.request('GET', 'invalid_connection_info')
185+
# Without the http_v2_enabled default definition, this request would time out.
186+
# Instead, it fails immediately
187+
self.assertEqual(r.status_code, 500)

0 commit comments

Comments
 (0)