Skip to content

Commit 09e65ff

Browse files
committed
Fix cancellation context bug
1 parent 99c015b commit 09e65ff

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

temporalio/nexus/_operation_handlers.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
from temporalio import client
2828
from temporalio.nexus._operation_context import (
29-
_temporal_start_operation_context,
29+
_temporal_cancel_operation_context,
3030
)
3131
from temporalio.nexus._token import WorkflowHandle
3232

@@ -105,27 +105,27 @@ async def fetch_result(
105105
)
106106
# An implementation is provided for future reference:
107107
# TODO: honor `wait` param and Request-Timeout header
108-
try:
109-
nexus_handle = WorkflowHandle[OutputT].from_token(token)
110-
except Exception as err:
111-
raise HandlerError(
112-
"Failed to decode operation token as workflow operation token. "
113-
"Fetching result for non-workflow operations is not supported.",
114-
type=HandlerErrorType.NOT_FOUND,
115-
cause=err,
116-
)
117-
ctx = _temporal_start_operation_context.get()
118-
try:
119-
client_handle = nexus_handle.to_workflow_handle(
120-
ctx.client, result_type=self._output_type
121-
)
122-
except Exception as err:
123-
raise HandlerError(
124-
"Failed to construct workflow handle from workflow operation token",
125-
type=HandlerErrorType.NOT_FOUND,
126-
cause=err,
127-
)
128-
return await client_handle.result()
108+
# try:
109+
# nexus_handle = WorkflowHandle[OutputT].from_token(token)
110+
# except Exception as err:
111+
# raise HandlerError(
112+
# "Failed to decode operation token as workflow operation token. "
113+
# "Fetching result for non-workflow operations is not supported.",
114+
# type=HandlerErrorType.NOT_FOUND,
115+
# cause=err,
116+
# )
117+
# ctx = _temporal_fetch_operation_context.get()
118+
# try:
119+
# client_handle = nexus_handle.to_workflow_handle(
120+
# ctx.client, result_type=self._output_type
121+
# )
122+
# except Exception as err:
123+
# raise HandlerError(
124+
# "Failed to construct workflow handle from workflow operation token",
125+
# type=HandlerErrorType.NOT_FOUND,
126+
# cause=err,
127+
# )
128+
# return await client_handle.result()
129129

130130

131131
async def cancel_operation(
@@ -148,7 +148,7 @@ async def cancel_operation(
148148
cause=err,
149149
)
150150

151-
ctx = _temporal_start_operation_context.get()
151+
ctx = _temporal_cancel_operation_context.get()
152152
try:
153153
client_workflow_handle = nexus_workflow_handle._to_client_workflow_handle(
154154
ctx.client

0 commit comments

Comments
 (0)