Skip to content

Commit cc0871d

Browse files
committed
Make validator interceptor sync
1 parent 03e3197 commit cc0871d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

temporalio/worker/_interceptor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ async def handle_query(self, input: HandleQueryInput) -> Any:
326326
"""Called to handle a query."""
327327
return await self.next.handle_query(input)
328328

329-
async def handle_update_validator(self, input: HandleUpdateInput) -> None:
329+
def handle_update_validator(self, input: HandleUpdateInput) -> None:
330330
"""Called to handle an update's validation stage."""
331-
return await self.next.handle_update_validator(input)
331+
return self.next.handle_update_validator(input)
332332

333333
async def handle_update_handler(self, input: HandleUpdateInput) -> Any:
334334
"""Called to handle an update's handler."""

temporalio/worker/_workflow_instance.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ async def run_update() -> None:
452452

453453
# Always run the validator interceptor, which will only actually run a validator if one is defined.
454454
with self._as_read_only():
455-
await self._inbound.handle_update_validator(handler_input)
455+
self._inbound.handle_update_validator(handler_input)
456456

457457
# Accept the update
458458
command.update_response.accepted.SetInParent()
@@ -1788,7 +1788,7 @@ async def handle_query(self, input: HandleQueryInput) -> Any:
17881788
else:
17891789
return handler(*input.args)
17901790

1791-
async def handle_update_validator(self, input: HandleUpdateInput) -> None:
1791+
def handle_update_validator(self, input: HandleUpdateInput) -> None:
17921792
# Do not "or None" the validator, since we only want to use the validator for
17931793
# the specific named update - we shouldn't fall back to the dynamic validator
17941794
# for some defined, named update which doesn't have a defined validator.

tests/worker/test_interceptor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ async def handle_query(self, input: HandleQueryInput) -> Any:
8080
interceptor_traces.append(("workflow.query", input))
8181
return await super().handle_query(input)
8282

83-
async def handle_update_validator(self, input: HandleUpdateInput) -> None:
83+
def handle_update_validator(self, input: HandleUpdateInput) -> None:
8484
interceptor_traces.append(("workflow.update.validator", input))
85-
return await super().handle_update_validator(input)
85+
return super().handle_update_validator(input)
8686

8787
async def handle_update_handler(self, input: HandleUpdateInput) -> Any:
8888
interceptor_traces.append(("workflow.update.handler", input))

0 commit comments

Comments
 (0)