Show HN: BreakerMachines – Modern Circuit Breaker for Rails with Async Support

https://news.ycombinator.com/rss Hits: 2
Summary

BreakerMachines Quick Start # Install gem ' breaker_machines ' # Use (Classic Mode - Works Everywhere) class PaymentService include BreakerMachines :: DSL circuit :stripe do threshold failures : 3 , within : 60 reset_after 30 fallback { { error : "Payment queued for later" } } end def charge ( amount ) circuit ( :stripe ) . wrap do Stripe :: Charge . create ( amount : amount ) end end end # Use (Fiber Mode - Optional, requires 'async' gem) class AIService include BreakerMachines :: DSL circuit :openai , fiber_safe : true do threshold failures : 2 , within : 30 timeout 5 # ACTUALLY SAFE! Uses Async::Task, not Thread#kill fallback { { error : "AI is contemplating existence, try again" } } end def generate ( prompt ) circuit ( :openai ) . wrap do # Non-blocking in Falcon! Your event loop thanks you openai . completions ( model : 'gpt-4' , prompt : prompt ) end end end That's it. Your service is now protected from cascading failures AND ready for the async future. Read on to understand why this matters. A Message to the Resistance So AI took your job while you were waiting for Fireship to drop the next JavaScript framework? Welcome to April 2005—when Git was born, branches were just master , and nobody cared about your pronouns. This is the pattern your company's distributed systems desperately need, explained in a way that won't make you fall asleep and impulse-buy developer swag just to feel something. Still reading? Good. Because in space, nobody can hear you scream about microservices. It's all just patterns and pain. The Pattern They Don't Want You to Know Built on the battle-tested state_machines gem, because I don't reinvent wheels here—I stop them from catching fire and burning down your entire infrastructure. BreakerMachines comes with fiber_safe mode out of the box. Cooperative timeouts, non-blocking I/O, Falcon server support—because it's 2025 and I built this for modern Ruby applications using Fibers, Ractors, and async patterns. 📖 Why I Open Sourced This - ...

First seen: 2025-07-06 13:23

Last seen: 2025-07-06 14:24