Skip to content

Commit 6f1eefc

Browse files
committed
Clean up Nexus
1 parent 72c1b76 commit 6f1eefc

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

temporalio/worker/_workflow_instance.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -1744,14 +1744,12 @@ async def run_child() -> Any:
17441744
async def _outbound_start_nexus_operation(
17451745
self, input: StartNexusOperationInput
17461746
) -> asyncio.Task:
1747-
# Function that runs in the handle
1747+
handle: _NexusOperationHandle
1748+
17481749
async def run_nexus() -> Any:
1749-
nonlocal handle
17501750
while True:
1751-
assert handle
17521751
try:
1753-
# We have to shield because we don't want the future itself
1754-
# to be cancelled
1752+
# shield to prevent the future itself being cancelled
17551753
return await asyncio.shield(handle._result_fut)
17561754
except asyncio.CancelledError:
17571755
raise NotImplementedError("Nexus operation cancel not implemented")
@@ -1761,11 +1759,11 @@ async def run_nexus() -> Any:
17611759
)
17621760
handle._apply_schedule_command()
17631761
self._pending_nexus_operations[handle._seq] = handle
1762+
17641763
# Wait on start before returning
17651764
while True:
17661765
try:
1767-
# We have to shield because we don't want the future itself
1768-
# to be cancelled
1766+
# shield to prevent the future itself being cancelled
17691767
await asyncio.shield(handle._start_fut)
17701768
return handle._task
17711769
except asyncio.CancelledError:

0 commit comments

Comments
 (0)