|
9 | 9 |
|
10 | 10 | ## Scene 1 — Channel intro (camera on screen, terminal open) |
11 | 11 |
|
| 12 | +*show the channel image* |
| 13 | + |
12 | 14 | > "Hey everyone, welcome to Hand-Rolled Code. This channel is about coding by hand — no vibe coding, no AI doing the thinking for me. Just me working through problems the old-fashioned way. I think there's real value in writing every line yourself — it forces you to actually understand what you're doing. All right. I'm planning to post sessions like this regularly, so if that sounds interesting, feel free to subscribe. |
13 | | -> |
| 15 | +
|
| 16 | +*Show the Ganesha logo* |
| 17 | + |
14 | 18 | > Today I want to introduce a PHP library called **Ganesha** — a circuit breaker implementation I've been maintaining. We're going to look at what the circuit breaker is, why it's useful, and how Ganesha implements it. And I'll walk through the basic API so you can start using it in your own projects. Cool, let's get into it." |
15 | 19 |
|
16 | 20 | --- |
17 | 21 |
|
18 | 22 | ## Scene 2 — What is the circuit breaker pattern? |
19 | 23 |
|
| 24 | +*Show episode-1-scene-02.png* |
| 25 | + |
20 | 26 | > "All right, let me start with the concept, because the code makes a lot more sense once you understand what problem we're solving. |
21 | 27 | > |
22 | 28 | > Imagine you have a web application that calls an external payment API. If that API is slow or down, your app starts accumulating requests waiting for a response. Those requests pile up, consuming threads and memory. Eventually your entire application grinds to a halt — not because of your own code, but because of a dependency that's failing. This is called a **cascading failure**. |
|
28 | 34 | > - **Open** — failures exceeded the threshold, requests are blocked |
29 | 35 | > - **Half-Open** — a trial period, one request is allowed through to test recovery |
30 | 36 |
|
31 | | -*Optionally show the diagram image from the README.* |
| 37 | +*Show Release It* |
| 38 | + |
| 39 | +> "This pattern was popularized by Michael Nygard in his 2007 book *Release It!*. |
| 40 | +
|
| 41 | +*Show Fowler's article* |
32 | 42 |
|
33 | | -> "This pattern was popularized by Michael Nygard in his 2007 book *Release It!*, and Martin Fowler later wrote a well-known article about it on his website. If you want to go deeper on the concept, Fowler's article is a great starting point — I'll link it in the description. |
| 43 | +> and Martin Fowler later wrote a well-known article about it on his website. If you want to go deeper on the concept, Fowler's article is a great starting point — I'll link it in the description. |
34 | 44 | > |
35 | 45 | > All right. Ganesha implements this pattern in PHP." |
36 | 46 |
|
|
0 commit comments