generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: catch async calls after retries are exhausted (#2190)
closes #2185 closes #2212 Retry directives can now define a catch verb: ```go //ftl:retry 10 1s catch example.catchPayments ``` Catch verbs have a special request type: ```go func CatchPayments(ctx context.Context, req builtin.CatchRequest[publisher.PubSubEvent]) error { // do something return nil } ``` Behavior: - FTL will keep attemping the catch verb until it does not return an error. It will do this at the backoff rate that the retries progressed to before catching. - `builtin.CatchRequest[EventType]` provides the original request and a string of the error that was returned on the last attempt by the subscriber - Once in a catch verb for a FSM transition, there is currently no way to prevent the FSM from reaching a failed state Behind the scenes: Async calls use a new row per attempt. This PR continues that pattern: - After the last attempt is completed, if there is a catching verb defined then a new row is added with `catching = true` - Originally I had gone down the road of making this a different state but it got tricky with `AcquireAsyncCall` coordinating leases with the `pending` and `executing` states, and would require 2 new states for the catching equivalent of those. - If the catch verb could not be called or fails, a new async call row is inserted with the current backoff - The next scheduled attempt to catch keeps the original verb's error, not the new catch error
- Loading branch information
Showing
31 changed files
with
1,029 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.