Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling in external signals #330

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jeffschoner
Copy link
Contributor

@jeffschoner jeffschoner commented Dec 29, 2024

This change is a follow up to #134 that improves error handling when using external signals to send a signal from one workflow to another.

The core change is that when sending a signal fails, the value returned by calling .get or passed as the argument to a callback on the future returned by workflow.signal_external_workflow now is an error indicating the error type rather than the fixed string of 'StandardError'. Previously, although the cause enum was passed to the dispatcher in the state manager, it was not propagated to callbacks on the future, only the fixed string.

Technically, this is a breaking change. It's unlikely existing usage of this would rely on a meaningless string constant. Still, usage of type checking of callback methods via Sorbet could be impacted when a different type is now passed (see Sorbet docs) even if the value is not used.

There's a few other supporting changes here:

  • The WaitForExternalSignalWorkflow sample has been updated. Its test has been updated for the most common failure mode that the target workflow does not exist. I've also added some default execution timeouts to these tests to reduce lingering workflow runs when the tests fail.
  • New StateManager and Workflow::Context unit specs have been added to cover this new failure mode as well as success cases previously not covered. These can be run with,
    • bundle exec rspec spec/unit/lib/temporal/workflow/context_spec.rb:265
    • bundle exec rspec spec/unit/lib/temporal/workflow/state_manager_spec.rb:437

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants