You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TaskHubGrpcClient has a close() method but does not implement __enter__/__exit__, so it cannot be used as a context manager. This means callers must remember to call close() manually (typically in a try/finally block), but no existing tests or examples do this — every callsite creates the client and never closes it, leaking the underlying gRPC channel.
AsyncTaskHubGrpcClient already has __aenter__/__aexit__, so there is an asymmetry between the sync and async clients.
Scope
This affects ~40+ callsites across the repository:
Problem
TaskHubGrpcClienthas aclose()method but does not implement__enter__/__exit__, so it cannot be used as a context manager. This means callers must remember to callclose()manually (typically in atry/finallyblock), but no existing tests or examples do this — every callsite creates the client and never closes it, leaking the underlying gRPC channel.AsyncTaskHubGrpcClientalready has__aenter__/__aexit__, so there is an asymmetry between the sync and async clients.Scope
This affects ~40+ callsites across the repository:
tests/durabletask/test_orchestration_e2e.pytests/durabletask/entities/test_function_based_entities_e2e.pytests/durabletask/entities/test_entity_failure_handling.pytests/durabletask/entities/test_class_based_entities_e2e.pyexamples/in_memory_backend_example/test/test_workflows.pyexamples/human_interaction.pyProposed Fix
__enter__/__exit__toTaskHubGrpcClient(mirrors the existing async pattern):withstatement:This also improves the getting-started experience and aligns with the
TaskHubGrpcWorkerpattern already used throughout the codebase.Notes
__enter__/__exit__is a non-breaking additive change