File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,9 @@ def __init__(self, *converters: EncodingPayloadConverter) -> None:
353353 converters: Payload converters to delegate to, in order.
354354 """
355355 self ._set_converters (* converters )
356+ self ._any_converter_takes_context = any (
357+ isinstance (c , WithSerializationContext ) for c in converters
358+ )
356359
357360 def _set_converters (self , * converters : EncodingPayloadConverter ) -> None :
358361 self .converters = {c .encoding .encode (): c for c in converters }
@@ -433,11 +436,13 @@ def with_context(self, context: SerializationContext) -> Self:
433436
434437 def get_converters_with_context (
435438 self , context : SerializationContext
436- ) -> Optional [List [EncodingPayloadConverter ]]:
439+ ) -> Optional [list [EncodingPayloadConverter ]]:
437440 """Return converter instances with context set.
438441
439442 If no converter uses context, return None.
440443 """
444+ if not self ._any_converter_takes_context :
445+ return None
441446 converters : list [EncodingPayloadConverter ] = []
442447 any_with_context = False
443448 for c in self .converters .values ():
Original file line number Diff line number Diff line change @@ -288,7 +288,7 @@ async def _handle_activation(
288288 else :
289289 payload_codec = _CommandAwarePayloadCodec (
290290 workflow .instance ,
291- self ._data_converter .payload_codec ,
291+ context_free_payload_codec = self ._data_converter .payload_codec ,
292292 )
293293 await temporalio .bridge .worker .decode_activation (
294294 act ,
@@ -363,7 +363,7 @@ async def _handle_activation(
363363 if self ._data_converter .payload_codec and workflow :
364364 payload_codec = _CommandAwarePayloadCodec (
365365 workflow .instance ,
366- self ._data_converter .payload_codec ,
366+ context_free_payload_codec = self ._data_converter .payload_codec ,
367367 )
368368 try :
369369 await temporalio .bridge .worker .encode_completion (
You can’t perform that action at this time.
0 commit comments