begin response = execution_timer.time(service, notifier, 'execution_time') do yield end success! # HALF-OPENͩͬͨ߹ɺCLOSEDʹ͢Δ rescue response = nil failure! # HALF_OPENͩͬͨ߹ɺOPENʹ / CLOSEDͩͬͨ߹ɺ݅ʹΑͬͯOPENʹ End end response end def http_get circuit.run do Zephyr.new('http://example.com').get('/api/messages') end end ˞͔ͳΓ؆ૉԽ͍ͯ͠·͢ɻࢀߟɿ(JU)VCͷ֘Օॴ
=> "http://example.com") do |c| c.use Circuitbox::FaradayMiddleware end response = conn.get("/api") if response.success? # success else # failure or open circuit end ˞3&"%.&͔Βͷൈਮ ˞'BSBEBZɺศརͳ)551ΫϥΠΞϯτϥΠϒϥϦʢ3VCZ,BJHJͰհ͞Ε͍ͯ·ͨ͠ʣ