Skip to content

Commit 3103cd0

Browse files
committed
Revert to mapping codec over structure
1 parent 6fe8dbe commit 3103cd0

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

temporalio/bridge/worker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,21 +297,21 @@ async def visit_payloads(self, payloads: MutableSequence[Payload]) -> None:
297297

298298
async def decode_activation(
299299
activation: temporalio.bridge.proto.workflow_activation.WorkflowActivation,
300-
decode: Callable[[Sequence[Payload]], Awaitable[List[Payload]]],
300+
codec: temporalio.converter.PayloadCodec,
301301
decode_headers: bool,
302302
) -> None:
303303
"""Decode all payloads in the activation."""
304304
await PayloadVisitor(
305305
skip_search_attributes=True, skip_headers=not decode_headers
306-
).visit(_Visitor(decode), activation)
306+
).visit(_Visitor(codec.decode), activation)
307307

308308

309309
async def encode_completion(
310310
completion: temporalio.bridge.proto.workflow_completion.WorkflowActivationCompletion,
311-
encode: Callable[[Sequence[Payload]], Awaitable[List[Payload]]],
311+
codec: temporalio.converter.PayloadCodec,
312312
encode_headers: bool,
313313
) -> None:
314314
"""Encode all payloads in the completion."""
315315
await PayloadVisitor(
316316
skip_search_attributes=True, skip_headers=not encode_headers
317-
).visit(_Visitor(encode), completion)
317+
).visit(_Visitor(codec.encode), completion)

temporalio/worker/_workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ async def _handle_activation(
293293
)
294294
await temporalio.bridge.worker.decode_activation(
295295
act,
296-
payload_codec.decode,
296+
payload_codec,
297297
decode_headers=self._encode_headers,
298298
)
299299
if not workflow:
@@ -369,7 +369,7 @@ async def _handle_activation(
369369
try:
370370
await temporalio.bridge.worker.encode_completion(
371371
completion,
372-
payload_codec.encode,
372+
payload_codec,
373373
encode_headers=self._encode_headers,
374374
)
375375
except Exception as err:

tests/worker/test_visitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ async def test_bridge_encoding():
236236
),
237237
)
238238

239-
await temporalio.bridge.worker.encode_completion(comp, SimpleCodec().encode, True)
239+
await temporalio.bridge.worker.encode_completion(comp, SimpleCodec(), True)
240240

241241
cmd = comp.successful.commands[0]
242242
sa = cmd.schedule_activity

0 commit comments

Comments
 (0)