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

Resilience #56

Merged
merged 14 commits into from
Mar 8, 2023
Merged

Resilience #56

merged 14 commits into from
Mar 8, 2023

Conversation

serras
Copy link
Member

@serras serras commented Mar 6, 2023

  • Intro
  • Schedule
  • CircuitBreaker
  • Saga

@serras serras changed the title [DRAFT] Resilience Resilience Mar 6, 2023
@ExperimentalTime
fun <A> complexPolicy(): Schedule<A, List<A>> =
Schedule.exponential<A>(10.milliseconds).whileOutput { it < 60.seconds }
.andThen(Schedule.spaced<A>(60.seconds) and Schedule.recurs(100)).jittered()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention what jittered does?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a line, I hadn't realized it was there

Comment on lines 193 to 195
Schedule.doWhile<Int>{ it <= 5 }.repeat {
counter++
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example may confuse some people because they could think the predicate is applied over the counter. What do you think? Would it be worth mentioning that it refers to the number of iterations? 0 to 5 plus the first successful execution?

After that, whenever more than two requests fail with an exception,
the circuit breaker starts short-circuiting failing-fast.

A new instance of `CircuitBreaker` is created using [`of`](https://arrow-kt.github.io/arrow/arrow-fx-resilience/arrow.fx.resilience/-circuit-breaker/-companion/of.html); there we specify
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The of builder has been deprecated since Arrow 1.2 in favor of the class constructor

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a note

serras and others added 7 commits March 8, 2023 09:59
Co-authored-by: Francisco Diaz <francisco.d@47deg.com>
Co-authored-by: Francisco Diaz <francisco.d@47deg.com>
Co-authored-by: Francisco Diaz <francisco.d@47deg.com>
Co-authored-by: Francisco Diaz <francisco.d@47deg.com>
@serras serras merged commit 8c17940 into main Mar 8, 2023
@serras serras deleted the resilience branch March 8, 2023 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants