Skip to content

Commit

Permalink
Unfinished handlers: add rule to warning message; test CAN, dynamic, …
Browse files Browse the repository at this point in the history
…and late-registered handlers (#612)
  • Loading branch information
dandavison authored Aug 19, 2024
1 parent 73a1673 commit 97688cc
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 89 deletions.
8 changes: 4 additions & 4 deletions temporalio/worker/_workflow_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,7 @@ def _make_unfinished_update_handler_message(
handler_executions: List[HandlerExecution],
) -> str:
message = """
Workflow finished while update handlers are still running. This may have interrupted work that the
[TMPRL1102] Workflow finished while update handlers are still running. This may have interrupted work that the
update handler was doing, and the client that sent the update will receive a 'workflow execution
already completed' RPCError instead of the update result. You can wait for all update and signal
handlers to complete by using `await workflow.wait_condition(lambda:
Expand All @@ -2797,12 +2797,12 @@ def _make_unfinished_signal_handler_message(
handler_executions: List[HandlerExecution],
) -> str:
message = """
Workflow finished while signal handlers are still running. This may have interrupted work that the
[TMPRL1102] Workflow finished while signal handlers are still running. This may have interrupted work that the
signal handler was doing. You can wait for all update and signal handlers to complete by using
`await workflow.wait_condition(lambda: workflow.all_handlers_finished())`. Alternatively, if both
you and the clients sending the signal are okay with interrupting running handlers when the workflow
finishes, and causing clients to receive errors, then you can disable this warning via the signal
handler decorator: `@workflow.signal(unfinished_policy=workflow.HandlerUnfinishedPolicy.ABANDON)`.
finishes, then you can disable this warning via the signal handler decorator:
`@workflow.signal(unfinished_policy=workflow.HandlerUnfinishedPolicy.ABANDON)`.
""".replace("\n", " ").strip()
names = collections.Counter(ex.name for ex in handler_executions)
return (
Expand Down
Loading

0 comments on commit 97688cc

Please sign in to comment.