Skip to content

Commit 5e644f2

Browse files
committed
Cleanup
1 parent 6a3a821 commit 5e644f2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

temporalio/worker/_workflow_instance.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,12 +2102,12 @@ def _converters_with_context(
21022102
def get_payload_codec(
21032103
self, command_seq: Optional[int]
21042104
) -> Optional[temporalio.converter.PayloadCodec]:
2105-
# This function is only called when the user's payload codec supports serialization context.
2105+
payload_codec = self._context_free_payload_codec
21062106
if not isinstance(
2107-
self._context_free_payload_codec,
2107+
payload_codec,
21082108
temporalio.converter.WithSerializationContext,
21092109
):
2110-
return self._context_free_payload_codec
2110+
return payload_codec
21112111

21122112
workflow_context = temporalio.converter.WorkflowSerializationContext(
21132113
namespace=self._info.namespace,
@@ -2117,7 +2117,7 @@ def get_payload_codec(
21172117
if command_seq is None:
21182118
# Use payload codec with workflow context by default (i.e. for payloads not associated
21192119
# with a pending command)
2120-
return self._context_free_payload_codec.with_context(workflow_context)
2120+
return payload_codec.with_context(workflow_context)
21212121

21222122
if command_seq in self._pending_activities:
21232123
handle = self._pending_activities[command_seq]
@@ -2134,15 +2134,15 @@ def get_payload_codec(
21342134
),
21352135
is_local=isinstance(handle._input, StartLocalActivityInput),
21362136
)
2137-
return self._context_free_payload_codec.with_context(context)
2137+
return payload_codec.with_context(context)
21382138

21392139
elif command_seq in self._pending_child_workflows:
21402140
handle = self._pending_child_workflows[command_seq]
21412141
context = temporalio.converter.WorkflowSerializationContext(
21422142
namespace=self._info.namespace,
21432143
workflow_id=handle._input.id,
21442144
)
2145-
return self._context_free_payload_codec.with_context(context)
2145+
return payload_codec.with_context(context)
21462146

21472147
elif command_seq in self._pending_external_signals:
21482148
# Use the target workflow's context for external signals
@@ -2151,17 +2151,17 @@ def get_payload_codec(
21512151
namespace=self._info.namespace,
21522152
workflow_id=workflow_id,
21532153
)
2154-
return self._context_free_payload_codec.with_context(context)
2154+
return payload_codec.with_context(context)
21552155

21562156
elif command_seq in self._pending_nexus_operations:
21572157
# Use empty context for nexus operations: users will never want to encrypt using a
21582158
# key derived from caller workflow context because the caller workflow context is
21592159
# not available on the handler side for decryption.
2160-
return self._context_free_payload_codec
2160+
return payload_codec
21612161

21622162
else:
21632163
# Use payload codec with workflow context for all other payloads
2164-
return self._context_free_payload_codec.with_context(workflow_context)
2164+
return payload_codec.with_context(workflow_context)
21652165

21662166
def _instantiate_workflow_object(self) -> Any:
21672167
if not self._workflow_input:

0 commit comments

Comments
 (0)