Skip to content

Commit 08b0e3b

Browse files
committed
remove context activate in handler
Signed-off-by: Tim Li <[email protected]>
1 parent ea56208 commit 08b0e3b

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

cadence/worker/_decision_task_handler.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,11 @@ async def _handle_task_implementation(self, task: PollForDecisionTaskResponse) -
8787

8888
# Create workflow context and execute with it active
8989
workflow_engine = self._workflow_engines[engine_key]
90-
workflow_info = WorkflowInfo(
91-
workflow_type=workflow_type_name,
92-
workflow_domain=self._client.domain,
93-
workflow_id=workflow_id,
94-
workflow_run_id=run_id
95-
)
9690

97-
context = Context(client=self._client, info=workflow_info)
98-
with context._activate():
99-
# Process the decision using the workflow engine
100-
decision_result = await workflow_engine.process_decision(task)
101-
102-
# Respond with the decisions
103-
await self._respond_decision_task_completed(task, decision_result)
91+
decision_result = await workflow_engine.process_decision(task)
92+
93+
# Respond with the decisions
94+
await self._respond_decision_task_completed(task, decision_result)
10495

10596
logger.info(f"Successfully processed decision task for workflow {workflow_id}")
10697

tests/cadence/worker/test_decision_task_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ async def test_workflow_engine_creation_with_workflow_info(self, handler, sample
322322
with patch('cadence.worker._decision_task_handler.WorkflowInfo') as mock_workflow_info_class:
323323
await handler._handle_task_implementation(sample_decision_task)
324324

325-
# Verify WorkflowInfo was created with correct parameters (called twice - once for engine, once for context)
326-
assert mock_workflow_info_class.call_count == 2
325+
# Verify WorkflowInfo was created with correct parameters (called once for engine)
326+
assert mock_workflow_info_class.call_count == 1
327327
for call in mock_workflow_info_class.call_args_list:
328328
assert call[1] == {
329329
'workflow_type': "TestWorkflow",

0 commit comments

Comments
 (0)