lib/breakers/uptime_middleware.rb in breakers-0.2.3 vs lib/breakers/uptime_middleware.rb in breakers-0.2.4
- old
+ new
@@ -33,10 +33,13 @@
end
protected
def outage_response(outage:, service:)
+ Breakers.client.plugins.each do |plugin|
+ plugin.on_skipped_request(service) if plugin.respond_to?(:on_skipped_request)
+ end
if Breakers.outage_response[:type] == :status_code
Faraday::Response.new.tap do |response|
response.finish(
status: Breakers.outage_response[:status_code],
body: "Outage detected on #{service.name} beginning at #{outage.start_time.to_i}",
@@ -67,10 +70,10 @@
Breakers.client.plugins.each do |plugin|
plugin.on_success(service, request_env, response_env) if plugin.respond_to?(:on_success)
end
end
end
- rescue Faraday::Error::TimeoutError => e
+ rescue Faraday::TimeoutError, Faraday::ConnectionFailed => e
handle_error(
service: service,
request_env: request_env,
response_env: nil,
error: "#{e.class.name} - #{e.message}",