Skip to content

Commit 1fceff7

Browse files
committed
wip
1 parent 10440b4 commit 1fceff7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

.changeset/public-books-unite.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,34 @@
22
"effect": minor
33
---
44

5-
add RetryPlan module
5+
add ExecutionPlan module
66

7-
A `RetryPlan` can be used with `Effect.retry` or `Stream.retry`, allowing you to provide different resources for each step of the plan.
7+
- A `ExecutionPlan` can be used with `Effect.withExecutionPlan` or `Stream.withExecutionPlan`, allowing you to provide different resources for each step of execution until the effect succeeds or the plan is exhausted.
88

99
```ts
10-
import type { AiLanguageModel } from "@effect/ai"
10+
import { type AiLanguageModel } from "@effect/ai"
1111
import type { Layer } from "effect"
12-
import { Effect, RetryPlan, Schedule } from "effect"
13-
14-
// usage
12+
import { Effect, ExecutionPlan, Schedule } from "effect"
1513

1614
declare const layerBad: Layer.Layer<AiLanguageModel.AiLanguageModel>
1715
declare const layerGood: Layer.Layer<AiLanguageModel.AiLanguageModel>
1816

19-
const ThePlan = RetryPlan.make({
17+
const ThePlan = ExecutionPlan.make({
2018
// First try with the bad layer 2 times with a 3 second delay between attempts
2119
provide: layerBad,
2220
attempts: 2,
2321
schedule: Schedule.spaced(3000)
2422
}).pipe(
2523
// Then try with the bad layer 3 times with a 1 second delay between attempts
26-
RetryPlan.orElse({
24+
ExecutionPlan.orElse({
2725
provide: layerBad,
2826
attempts: 3,
2927
schedule: Schedule.spaced(1000)
3028
}),
3129
// Finally try with the good layer.
3230
//
3331
// If `attempts` is omitted, the plan will only attempt once, unless a schedule is provided.
34-
RetryPlan.orElse({
32+
ExecutionPlan.orElse({
3533
provide: layerGood
3634
})
3735
)
@@ -41,5 +39,5 @@ declare const effect: Effect.Effect<
4139
never,
4240
AiLanguageModel.AiLanguageModel
4341
>
44-
const retriedEffect: Effect.Effect<void> = Effect.retry(effect, ThePlan)
42+
const withPlan: Effect.Effect<void> = Effect.withExecutionPlan(effect, ThePlan)
4543
```

0 commit comments

Comments
 (0)