You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/circuit-breaker.md
+36-24Lines changed: 36 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,20 @@
1
1
# Circuit Breaker
2
2
3
-
The circuit breaker pattern prevents cascading failures when an API goes down. Instead of repeatedly hitting a failing service, the circuit breaker "opens" and immediately rejects requests, giving the service time to recover.
3
+
The circuit breaker pattern prevents cascading failures when an API goes down.
4
+
Instead of repeatedly hitting a failing service, the circuit breaker "opens" and
5
+
immediately rejects requests, giving the service time to recover.
4
6
5
7
## Why Use a Circuit Breaker?
6
8
7
9
Without a circuit breaker, when a service fails:
10
+
8
11
1. Every request waits for a timeout
9
12
2. Your app becomes slow and unresponsive
10
13
3. You waste resources on doomed requests
11
14
4. The failing service gets overwhelmed with retry attempts
12
15
13
16
With a circuit breaker:
17
+
14
18
1. After detecting failures, requests fail immediately
15
19
2. Your app stays responsive
16
20
3. The failing service gets breathing room
@@ -40,8 +44,10 @@ With a circuit breaker:
40
44
```
41
45
42
46
-**CLOSED**: Normal operation. Requests pass through, failures are tracked.
Copy file name to clipboardExpand all lines: docs/guide/configuration.md
+18-6Lines changed: 18 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,14 @@
1
1
# Configuration
2
2
3
-
FetchClient uses a **default provider** behind the scenes that manages shared configuration, cache, and state for your entire app. You don't need to create or manage providers directly - just call the configuration functions and everything works.
3
+
FetchClient uses a **default provider** behind the scenes that manages shared
4
+
configuration, cache, and state for your entire app. You don't need to create or
5
+
manage providers directly - just call the configuration functions and everything
6
+
works.
4
7
5
8
## How It Works
6
9
7
-
When you use `new FetchClient()` or call functions like `getJSON()`, they all share the same default provider. This means:
10
+
When you use `new FetchClient()` or call functions like `getJSON()`, they all
11
+
share the same default provider. This means:
8
12
9
13
-**Shared configuration** - Set `baseUrl` once, use it everywhere
10
14
-**Shared cache** - Cache entries are available to all clients
@@ -262,4 +271,7 @@ export async function deleteUser(id: number) {
262
271
263
272
## Advanced: Custom Providers
264
273
265
-
For advanced use cases like connecting to multiple APIs with different configurations, you can create separate `FetchClientProvider` instances. See the [API reference](https://jsr.io/@foundatiofx/fetchclient/doc/~/FetchClientProvider) for details.
274
+
For advanced use cases like connecting to multiple APIs with different
275
+
configurations, you can create separate `FetchClientProvider` instances. See the
0 commit comments