Skip to content

Commit 524ddb2

Browse files
committed
Avoid client wrapper redeclaration
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 76f2163a-0773-4889-b627-1bd4e5c7bea0
1 parent dbebdb4 commit 524ddb2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • azure-functions-durable/azure/durable_functions/decorators

azure-functions-durable/azure/durable_functions/decorators/durable_app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,23 +434,25 @@ def set_client_metadata(client_bound: Callable[..., Any]) -> None:
434434

435435
if inspect.iscoroutinefunction(function):
436436
@wraps(function)
437-
async def client_bound(*args: Any, **kwargs: Any) -> Any:
437+
async def async_client_bound(*args: Any, **kwargs: Any) -> Any:
438438
bound, client = bind_client(args, kwargs)
439439
try:
440440
result = function(*bound.args, **bound.kwargs)
441441
return await result
442442
finally:
443443
if isinstance(client, DurableFunctionsClient):
444444
client.schedule_close()
445+
client_bound = async_client_bound
445446
else:
446447
@wraps(function)
447-
def client_bound(*args: Any, **kwargs: Any) -> Any:
448+
def sync_client_bound(*args: Any, **kwargs: Any) -> Any:
448449
bound, client = bind_client(args, kwargs)
449450
try:
450451
return function(*bound.args, **bound.kwargs)
451452
finally:
452453
if isinstance(client, DurableFunctionsClient):
453454
client.schedule_close()
455+
client_bound = sync_client_bound
454456

455457
set_client_metadata(client_bound)
456458
if isinstance(user_fn, FunctionBuilder):

0 commit comments

Comments
 (0)