Skip to content

Commit b18ebac

Browse files
committed
note tweeks
1 parent 2aa392d commit b18ebac

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

notes/0.2.0.markdown

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
### retry.Policy
44

5-
Retries are now defined in terms of a common and easier to work with interface, a `retry.Policy`, which is essentially the interface
5+
Retries are now defined in terms of a common and easier to work with interface, a `retry.Policy`, which is in essence the type
66

77
() => Future[T] => Future[T]
88

9-
with a few implicit parameters. One for an instance of `retry.Success[T]` and one for an ExecutionContext.
10-
This makes retries easier to pass around as a general interface.
9+
with a few implicit parameters: one for an instance of a `retry.Success[T]` and one for an `scala.concurrent.ExecutionContext`.
10+
11+
This makes the packaging of retry logic more portable as easier to swap implementations in an out.
1112

1213
trait Policy {
1314
def apply[T](promise: () => Future[T])
@@ -19,7 +20,7 @@ The previous three categories of retry attempts, `retry.Directly`, `retry.Pause`
1920

2021
### retry forever
2122

22-
It was previously only possible to retry for a finite number of times. Sometimes you want to try, try, and try again until your future's value meets your definition of `retry.Success`. Each of the 3 retry modules now expose a `forever` method that will keep retrying until a successful result is produced using semantics tied to the type of retry.
23+
It was previously only possible to retry for a finite number of times. Sometimes you want to try, try, and try again until your future arrives at a succesful conclusion. Each of the 3 retry modules now expose a `forever` method that will keep retrying until a successful result is produced using semantics tied to the type of retry.
2324

2425
// retry pausing 1 second forever until tryHarder tries hard enough
2526
val forever = retry.Pause.forever(1.second)
@@ -56,14 +57,15 @@ A library for retrying operations has a heavy interest understanding what it mea
5657
5758
This interface defines a simple algebra for Ints. Your application most like defines Futures which return a more complex type. Experiment with this new interface to compose different definitions of success for your applications types to enrich your retry experience.
5859

59-
If you are feeling adventurous you consider `retry.Success.always` or `retry.Success.never` which will either infer success from any resulting value
60+
If you are feeling adventurous, consider using `retry.Success.always` or `retry.Success.never` which will either infer success from any resulting value
6061
or no resulting value respectively.
6162

6263
### re-determine how to retry When the right stars are in alignment
6364

64-
Sometimes things don't go according to plan. Sometimes you are working with "exceptional" code that expresses failure with fantastic runtime exceptions.
65+
Sometimes things don't go according to plan. Sometimes you are forced to share the wheel with "exceptional" code that expresses failure with fantastic runtime exceptions.
66+
6567
Sometimes you are working with a rate-limited service that will respond with a suggested time to come back knocking at a later time.
66-
For these cases retry exposes an adaptive interface called `retry.When` which return takes a PartialFunction of Any to Policy.
68+
For these types of usecases, retry exposes an adaptive interface called `retry.When` which takes a PartialFunction of Any to retry.Policy which allows you to adapt to any kind of failure you throw at it.
6769

6870
val policy = retry.When {
6971
case RetryAt(time) => retry.Pause(delay = time.seconds)

0 commit comments

Comments
 (0)