{"id":"6b093dbf91bd8fbaf2a0c8a7","slug":"circuit-breaker","title":"Circuit breaker: turning a slow failure into a fast one","summary":"The Circuit Breaker pattern from the ground up: closed, open and half-open states, thresholds and windows, filtering business errors, working with timeouts, retries and bulkheads. Configuration in Polly, opossum, Resilience4j, gobreaker and pybreaker.","servedLang":"en","availableLangs":["pl","en"],"topics":["circuit-breaker","microservices","state"],"techs":["dotnet","typescript","java","go","python"],"tags":["resilience","circuit-breaker","fault-tolerance","timeouts","retries","bulkhead","distributed-systems"],"level":"intermediate","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":11,"stats":{"views":2,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-27T08:22:23.815Z","updatedAt":"2026-11-27T13:14:39.233Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"teal","background":"dots","weaveResources":true,"toc":"right"},"seoDescription":"Circuit breaker pattern: closed/open/half-open states, failure threshold, sliding window, timeout, retry, bulkhead, fallback, Polly v8 and Microsoft.Extensions.Http.Resilience, opossum, Resilience4j, sony/gobreaker, pybreaker, common misconfigurations.","wordCount":2072,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Friday, 8 p.m., peak shopping time. The payment gateway starts answering after 30 seconds, or not at all. The shop waits for every response, the thread and connection pools run dry, and a few minutes later nothing works – including the catalog and the cart, which have nothing to do with payments. One sick dependency took down the whole system. A "},{"type":"text","text":"Circuit Breaker","marks":[{"type":"bold"}]},{"type":"text","text":" works like the one in a home fuse box: after a series of failures it trips and lets no calls through for a while, then carefully checks whether they can resume."}]},{"type":"callout","attrs":{"variant":"tip","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A circuit breaker wraps calls to a remote dependency and "},{"type":"text","text":"counts failures","marks":[{"type":"bold"}]},{"type":"text","text":"; above a threshold it stops calling it and fails immediately."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Three states: "},{"type":"text","text":"closed","marks":[{"type":"bold"}]},{"type":"text","text":" (traffic flows), "},{"type":"text","text":"open","marks":[{"type":"bold"}]},{"type":"text","text":" (immediate rejection), "},{"type":"text","text":"half-open","marks":[{"type":"bold"}]},{"type":"text","text":" (a few trial calls decide whether to return to normal)."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"It only works together with a "},{"type":"text","text":"timeout","marks":[{"type":"bold"}]},{"type":"text","text":" and sensible error handling on the caller's side (a fallback value, a queue, a message)."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"3","label":"states","hint":"closed, open, half-open"},{"value":"2007","label":"\"Release It!\"","hint":"Michael Nygard describes the pattern in the context of production systems"},{"value":"2018","label":"Hystrix in maintenance mode","hint":"Netflix recommends Resilience4j as the successor"}]}},{"type":"heading","attrs":{"level":2,"id":"the-problem-cascading-failure"},"content":[{"type":"text","text":"The problem: cascading failure"}]},{"type":"paragraph","content":[{"type":"text","text":"A service that does not answer right away is more dangerous than one that fails right away. Every gateway call holds a thread, an HTTP connection and memory for the whole wait. Under heavy traffic the resources run out within seconds, and further requests – even to other endpoints – queue up. On top of that, customers and their browsers retry, so the sick gateway gets even more traffic."}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"checkout.before.ts"},"content":[{"type":"text","text":"// No timeout, no breaker: every request waits as long as the gateway wants.\napp.post(\"/checkout\", async (req, res) => {\n  const receipt = await gateway.charge(req.body.order); // 30 s... or never\n  res.json(receipt);\n});"}]},{"type":"heading","attrs":{"level":2,"id":"the-solution-a-state-machine-in-front-of-the-call"},"content":[{"type":"text","text":"The solution: a state machine in front of the call"}]},{"type":"paragraph","content":[{"type":"text","text":"The breaker sits between the code and the dependency and has the same interface as the call it protects (structurally it is a proxy). In the "},{"type":"text","text":"closed","marks":[{"type":"bold"}]},{"type":"text","text":" state it lets traffic through and counts failures. When they cross the threshold it moves to "},{"type":"text","text":"open","marks":[{"type":"bold"}]},{"type":"text","text":": for a set time it rejects calls immediately without touching the dependency. After that it moves to "},{"type":"text","text":"half-open","marks":[{"type":"bold"}]},{"type":"text","text":" and lets a few trial calls through – if they succeed it goes back to closed, if not it opens again."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"stateDiagram-v2\n  state \"Half-open\" as HalfOpen\n  [*] --> Closed\n  Closed --> Closed : success – failure count reset\n  Closed --> Open : failure threshold exceeded\n  Open --> HalfOpen : open timeout elapsed\n  HalfOpen --> Closed : trial calls succeeded\n  HalfOpen --> Open : a trial call failed","caption":"Circuit breaker states and transitions"}},{"type":"diagram","attrs":{"kind":"mermaid","code":"sequenceDiagram\n  autonumber\n  participant C as Checkout\n  participant B as Breaker\n  participant G as Payment gateway\n  C->>B: charge(order 41)\n  B->>G: POST /charges\n  G--xB: timeout after 3 s (failure no. 20 – threshold reached)\n  B-->>C: error, circuit OPEN\n  C->>B: charge(order 42)\n  B-->>C: immediate rejection (the gateway is not called)\n  Note over C: fallback – the order goes to the payment queue\n  Note over B: after 30 s the state is HALF-OPEN\n  C->>B: charge(order 43)\n  B->>G: trial call\n  G-->>B: 200 OK\n  B-->>C: receipt, circuit CLOSED","caption":"While open, the answer comes in milliseconds and the gateway gets time to recover"}},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Setting"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Meaning"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Typical value"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Failure threshold"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"failures in a row, or the failure percentage in a window"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"5 in a row or 50%"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Minimum number of calls"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"below it the percentage is not evaluated"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"10–20"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Measurement window"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"the number of calls or the time span used for statistics"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"20 calls or 30 s"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Open duration"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"how long the circuit rejects calls"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"15–60 s"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Trial calls"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"how many calls the half-open state lets through"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"1–5"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Error filter"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"which errors count (outages, not business errors)"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"5xx, timeouts, network errors"}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"implementation-in-five-languages"},"content":[{"type":"text","text":"Implementation in five languages"}]},{"type":"paragraph","content":[{"type":"text","text":"Breakers are rarely written from scratch – every ecosystem has a mature library. Below is the same policy for the payment gateway: a 3 s timeout, opening at 50% failures (or a run of failures), a 30 s break, a declined card does not count as an outage, and while open the order goes to a payment queue."}]},{"type":"codeGroup","attrs":{"title":"Circuit breaker in front of a payment gateway"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"Program.cs"},"content":[{"type":"text","text":"// Polly v8 + Microsoft.Extensions.Http.Resilience: a typed HttpClient guarded by a circuit breaker.\nbuilder.Services.AddHttpClient<PaymentGatewayClient>(c => c.BaseAddress = new Uri(\"https://gateway.example\"))\n    .AddResilienceHandler(\"payments\", pipeline =>\n    {\n        // Strategies added first wrap the later ones: the breaker sees the timeouts of single attempts.\n        pipeline.AddCircuitBreaker(new HttpCircuitBreakerStrategyOptions\n        {\n            FailureRatio = 0.5,                          // open at 50% failures...\n            MinimumThroughput = 20,                      // ...out of at least 20 calls...\n            SamplingDuration = TimeSpan.FromSeconds(30), // ...within a 30 s window\n            BreakDuration = TimeSpan.FromSeconds(30),    // then stay open for 30 s\n            // The default ShouldHandle counts 5xx, 408, 429 and exceptions – a 402 \"card declined\" does not trip it.\n        });\n        pipeline.AddTimeout(TimeSpan.FromSeconds(3));    // a slow call becomes a failure\n    });\n\npublic sealed class CheckoutService(PaymentGatewayClient gateway, IPaymentQueue queue, ILogger<CheckoutService> log)\n{\n    public async Task<CheckoutResult> PayAsync(Order order, CancellationToken ct)\n    {\n        try\n        {\n            return CheckoutResult.Paid(await gateway.ChargeAsync(order, ct));\n        }\n        catch (BrokenCircuitException) // the circuit is open – no call was made\n        {\n            log.LogWarning(\"Payment gateway circuit open, queueing order {OrderId}\", order.Id);\n            await queue.EnqueueAsync(order, ct); // fallback: take the order, charge later\n            return CheckoutResult.PendingPayment(order.Id);\n        }\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"payments.ts"},"content":[{"type":"text","text":"import CircuitBreaker from \"opossum\";\n\n// opossum wraps any function returning a Promise.\nconst charge = (order: Order): Promise<Receipt> => gateway.charge(order);\n\nconst breaker = new CircuitBreaker(charge, {\n  timeout: 3000, // slower than 3 s = failure\n  errorThresholdPercentage: 50, // open at 50% failures...\n  volumeThreshold: 20, // ...once at least 20 calls were made\n  rollingCountTimeout: 30000, // statistics window\n  resetTimeout: 30000, // after 30 s let a trial call through (half-open)\n  errorFilter: (err: unknown) => err instanceof CardDeclinedError, // true = do not count this error\n});\n\nbreaker.fallback(async (order: Order) => {\n  await paymentQueue.enqueue(order); // take the order, charge later\n  return { orderId: order.id, status: \"pending\" } satisfies Receipt;\n});\n\nbreaker.on(\"open\", () => logger.warn(\"payments circuit OPEN\"));\nbreaker.on(\"halfOpen\", () => logger.info(\"payments circuit HALF-OPEN – trial call\"));\nbreaker.on(\"close\", () => logger.info(\"payments circuit CLOSED\"));\n\nexport const pay = (order: Order): Promise<Receipt> => breaker.fire(order);"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"PaymentService.java"},"content":[{"type":"text","text":"// Resilience4j: a sliding window, slow calls counted as failures, business exceptions ignored.\n@Service\nclass PaymentService {\n    private static final Logger log = LoggerFactory.getLogger(PaymentService.class);\n    private final PaymentGateway gateway;\n    private final PaymentQueue queue;\n    private final CircuitBreaker breaker;\n\n    PaymentService(PaymentGateway gateway, PaymentQueue queue) {\n        this.gateway = gateway;\n        this.queue = queue;\n        CircuitBreakerConfig config = CircuitBreakerConfig.custom()\n            .slidingWindowType(CircuitBreakerConfig.SlidingWindowType.COUNT_BASED)\n            .slidingWindowSize(20)\n            .minimumNumberOfCalls(20)\n            .failureRateThreshold(50)                          // open at 50% failures in the window\n            .slowCallDurationThreshold(Duration.ofSeconds(3))  // a call slower than 3 s...\n            .slowCallRateThreshold(50)                         // ...counts towards opening as well\n            .waitDurationInOpenState(Duration.ofSeconds(30))\n            .permittedNumberOfCallsInHalfOpenState(3)\n            .ignoreExceptions(CardDeclinedException.class)     // business errors do not trip the breaker\n            .build();\n        this.breaker = CircuitBreakerRegistry.of(config).circuitBreaker(\"payments\");\n        breaker.getEventPublisher().onStateTransition(e -> log.warn(\"payments: {}\", e.getStateTransition()));\n    }\n\n    Receipt pay(Order order) {\n        Supplier<Receipt> guarded = CircuitBreaker.decorateSupplier(breaker, () -> gateway.charge(order));\n        try {\n            return guarded.get();\n        } catch (CallNotPermittedException open) { // the circuit is open – no call was made\n            queue.enqueue(order);\n            return Receipt.pending(order.id());\n        }\n    }\n    // Spring Boot alternative: @CircuitBreaker(name = \"payments\", fallbackMethod = \"queuePayment\") + YAML config.\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"payments.go"},"content":[{"type":"text","text":"package payments\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/sony/gobreaker/v2\"\n)\n\nvar ErrCardDeclined = errors.New(\"card declined\")\n\nvar breaker = gobreaker.NewCircuitBreaker[*Receipt](gobreaker.Settings{\n\tName:        \"payments\",\n\tMaxRequests: 3,                // trial calls allowed in half-open\n\tInterval:    30 * time.Second, // while closed, reset the counts every 30 s\n\tTimeout:     30 * time.Second, // open → half-open after 30 s\n\tReadyToTrip: func(c gobreaker.Counts) bool {\n\t\treturn c.Requests >= 20 && float64(c.TotalFailures)/float64(c.Requests) >= 0.5\n\t},\n\t// Business errors are \"successful\" from the breaker's point of view.\n\tIsSuccessful: func(err error) bool { return err == nil || errors.Is(err, ErrCardDeclined) },\n\tOnStateChange: func(name string, from, to gobreaker.State) {\n\t\tlog.Printf(\"%s: %s -> %s\", name, from, to)\n\t},\n})\n\nfunc Pay(ctx context.Context, order Order) (*Receipt, error) {\n\tctx, cancel := context.WithTimeout(ctx, 3*time.Second) // a slow call becomes a failure\n\tdefer cancel()\n\treceipt, err := breaker.Execute(func() (*Receipt, error) { return gateway.Charge(ctx, order) })\n\tif errors.Is(err, gobreaker.ErrOpenState) || errors.Is(err, gobreaker.ErrTooManyRequests) {\n\t\tif qerr := queue.Enqueue(ctx, order); qerr != nil {\n\t\t\treturn nil, qerr\n\t\t}\n\t\treturn &Receipt{OrderID: order.ID, Status: \"pending\"}, nil // fallback: charge later\n\t}\n\treturn receipt, err\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"payments.py"},"content":[{"type":"text","text":"import logging\n\nimport pybreaker\nimport requests\n\nlog = logging.getLogger(__name__)\n\n\nclass CardDeclined(Exception):\n    pass\n\n\nclass LogStateChanges(pybreaker.CircuitBreakerListener):\n    def state_change(self, cb, old_state, new_state):\n        log.warning(\"payments circuit: %s -> %s\", old_state.name, new_state.name)\n\n\npayments_breaker = pybreaker.CircuitBreaker(\n    fail_max=5,              # 5 failures in a row open the circuit\n    reset_timeout=30,        # seconds until a trial call (half-open)\n    exclude=[CardDeclined],  # business errors do not count\n    listeners=[LogStateChanges()],\n)\n\n\n@payments_breaker\ndef charge(order: \"Order\") -> \"Receipt\":\n    response = requests.post(GATEWAY_URL, json=order.to_json(), timeout=(3.05, 5))  # connect, read\n    if response.status_code == 402:\n        raise CardDeclined(order.id)\n    response.raise_for_status()\n    return Receipt.from_json(response.json())\n\n\ndef pay(order: \"Order\") -> \"Receipt\":\n    try:\n        return charge(order)\n    except pybreaker.CircuitBreakerError:  # the circuit is open – fail fast\n        payment_queue.enqueue(order)       # take the order, charge later\n        return Receipt.pending(order.id)"}]}]}]},"toc":[{"id":"the-problem-cascading-failure","text":"The problem: cascading failure","level":2,"locked":false},{"id":"the-solution-a-state-machine-in-front-of-the-call","text":"The solution: a state machine in front of the call","level":2,"locked":false},{"id":"implementation-in-five-languages","text":"Implementation in five languages","level":2,"locked":false},{"id":"the-breaker-in-the-family-of-resilience-patterns","text":"The breaker in the family of resilience patterns","level":2,"locked":true},{"id":"when-to-use-it-and-when-not","text":"When to use it and when not","level":2,"locked":true},{"id":"history","text":"History","level":2,"locked":true},{"id":"related-topics","text":"Related topics","level":2,"locked":true},{"id":"in-practice","text":"In practice","level":2,"locked":true},{"id":"check-yourself","text":"Check yourself","level":2,"locked":true},{"id":"practice-challenge","text":"Practice challenge","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":36,"visibleBlocks":14,"resources":[{"id":"6b0857be3c96f2d34d0b41eb","type":"article","provider":"web","url":"https://martinfowler.com/bliki/CircuitBreaker.html","embedUrl":null,"title":"bliki: Circuit Breaker","description":"You use software circuit breakers on connections to remote services. These breakers trip when the supplier becomes unresponsive, once tripped the breaker no longer calls the supplier until reset.","author":"Martin Fowler","thumbnailUrl":"https://martinfowler.com/bliki/images/circuitBreaker/card.png","durationSec":null,"lang":"en","topics":["microservices"],"techs":["general"],"tags":["martin-fowler","resilience","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":75,"verifiedAt":"2026-11-26T11:07:25.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857bf3c96f2d34d0b4298","type":"article","provider":"web","url":"https://learn.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker","embedUrl":null,"title":"Circuit Breaker Pattern","description":"Learn how to handle faults that might take varying amounts of time to fix when applications connect to a remote service or resource.","author":"Microsoft Azure Architecture Center","thumbnailUrl":"https://learn.microsoft.com/en-us/media/open-graph-image.png","durationSec":null,"lang":"en","topics":["microservices"],"techs":["general"],"tags":["azure","cloud","resilience","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":64,"verifiedAt":"2026-11-26T11:07:44.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857c23c96f2d34d0b462b","type":"article","provider":"web","url":"https://shopify.engineering/circuit-breaker-misconfigured","embedUrl":null,"title":"Your Circuit Breaker is Misconfigured - Shopify","description":"Learn to predict how your application will behave in times of failure and how to configure every parameter for your Semian circuit breaker.","author":"Shopify Engineering","thumbnailUrl":"https://cdn.shopify.com/s/files/1/0779/4361/articles/YourCircuitBreakerIsMisconfigured_d89c674c-95b4-4270-8dd2-a1c4f89910ec.jpg?v=1582055933","durationSec":null,"lang":"en","topics":["microservices"],"techs":["general"],"tags":["resilience","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":50,"verifiedAt":"2026-11-26T11:28:39.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:04.995Z","updatedAt":"2026-11-26T16:01:04.995Z"},{"id":"6b0857c33c96f2d34d0b4690","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL8848832W","embedUrl":null,"title":"Release It!","description":"","author":"Michael T. Nygard","thumbnailUrl":"https://covers.openlibrary.org/b/id/743624-L.jpg","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["book","testing"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"2007-01-01T00:00:00.000Z","popularity":51,"verifiedAt":"2026-11-26T11:00:08.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:04.995Z","updatedAt":"2026-11-26T16:01:04.995Z"},{"id":"6b0857ab3c96f2d34d0b3269","type":"package","provider":"nuget","url":"https://www.nuget.org/packages/Polly","embedUrl":null,"title":"Polly","description":"Resilience strategies for .NET: retry, circuit breaker, timeout, hedging, rate limiting.","author":"","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["microservices","strategy"],"techs":["dotnet"],"tags":["resilience"],"price":"free","featured":false,"featuredOrder":24,"packageName":"Polly","source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:42.955Z","updatedAt":"2026-11-26T16:00:42.955Z"},{"id":"6b0857b23c96f2d34d0b3563","type":"repo","provider":"github","url":"https://github.com/sony/gobreaker","embedUrl":null,"title":"sony/gobreaker","description":"Circuit Breaker implemented in Go","author":"sony","thumbnailUrl":"https://opengraph.githubassets.com/1/sony/gobreaker","durationSec":null,"lang":"en","topics":["microservices"],"techs":["go"],"tags":["circuit-breaker","golang","microservice","resilience","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"github","publishedAt":"2015-05-29T04:46:15.000Z","popularity":69,"verifiedAt":"2026-11-26T10:58:37.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:50.215Z","updatedAt":"2026-11-26T16:00:50.215Z"}],"challenges":[{"id":"6b093dc291bd8fbaf2a0c8d8","slug":"payment-circuit-breaker","title":"Circuit breaker for a payment gateway","summary":"A circuit breaker with closed, open and half-open states, an injected clock, a trial-success threshold and a business-error filter – so a payment gateway outage does not take the whole shop down.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"architecture","status":"published","difficulty":"hard","topics":["circuit-breaker","microservices"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["circuit-breaker","resilience","fault-tolerance","state-machine","payments"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":40,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:26.251Z"},{"id":"6b093ddfbd4755deb67ee092","slug":"retry-with-backoff","title":"Retry with exponential backoff","summary":"A function that retries a failed operation after 100, 200, 400… ms, with a cap and an error filter. The sleep function is injected, so tests never wait a millisecond.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"algorithms","status":"published","difficulty":"easy","topics":["circuit-breaker"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["resilience","backoff","higher-order-functions","dependency-injection","async"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":10,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:55.300Z"},{"id":"6b093dc291bd8fbaf2a0c8e4","slug":"subscription-state","title":"Subscription lifecycle as a state machine","summary":"A SaaS subscription moves through trial, active, past-due and cancelled. Every state is a separate class that decides about transitions itself – no ever-growing switch.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"pattern","status":"published","difficulty":"medium","topics":["state"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["state","state-machine","subscriptions","billing","behavioral"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":20,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:26.723Z"}],"attachments":[],"hasCode":true,"repoUrl":null,"series":[],"prev":null,"next":null,"featured":false,"authorCard":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","headline":"Wzorce projektowe · Architektura · AI i LLM","community":false,"reputation":{"points":3900,"level":{"key":"mentor","label":"Mentor"}},"articles":68,"skills":[{"key":"typescript","title":"TypeScript","level":5,"levelLabel":"Authority","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Authority","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Authority","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Authority","articles":38}]}}