Skip to content

Commit 59ff0e0

Browse files
author
Victoria Hall
committedMar 18, 2025·
a27: fix sync functions
1 parent cb83fcc commit 59ff0e0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed
 

‎azure_functions_worker_v2/handle_event.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
PYTHON_SCRIPT_FILE_NAME,
4444
PYTHON_SCRIPT_FILE_NAME_DEFAULT,
4545
PYTHON_ENABLE_DEBUG_LOGGING)
46-
from .utils.current import get_current_loop, execute, run_sync_func
46+
from .utils.current import get_current_loop, execute_async, run_sync_func
4747
from .utils.env_state import get_app_setting, is_envvar_true
4848
from .utils.helpers import change_cwd, get_worker_metadata
4949
from .utils.tracing import serialize_exception
@@ -217,7 +217,7 @@ async def invocation_request(request):
217217
if otel_manager.get_azure_monitor_available():
218218
configure_opentelemetry(fi_context)
219219

220-
call_result = await execute(fi.func, args) # Not supporting Extensions
220+
call_result = await execute_async(fi.func, args) # Not supporting Extensions
221221
else:
222222
_loop = get_current_loop()
223223
call_result = await _loop.run_in_executor(

‎azure_functions_worker_v2/utils/current.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ def get_current_loop():
1313
return asyncio.events.get_event_loop()
1414

1515

16-
async def execute(function, args) -> Any:
16+
async def execute_async(function, args) -> Any:
1717
return await function(**args)
1818

19+
def execute_sync(function, args) -> Any:
20+
return function(**args)
21+
1922

2023
def run_sync_func(invocation_id, context, func, params):
2124
# This helper exists because we need to access the current
@@ -24,7 +27,7 @@ def run_sync_func(invocation_id, context, func, params):
2427
try:
2528
if otel_manager.get_azure_monitor_available():
2629
configure_opentelemetry(context)
27-
result = functools.partial(execute, func)
30+
result = functools.partial(execute_sync, func)
2831
return result(params)
2932
finally:
3033
context.thread_local_storage.invocation_id = None

‎azure_functions_worker_v2/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
VERSION = '1.0.0a26'
4+
VERSION = '1.0.0a27'

0 commit comments

Comments
 (0)
Please sign in to comment.