Flipper Cloud

Failsafe adapter

The Failsafe adapter wraps another adapter and fails safely when an exception is raised. This prevents issues like network hiccups from taking down an application using Flipper.

Installation

This adapter is included with the flipper gem.

Usage

Flipper.configure do |config|
  config.adapter do
    Flipper::Adapters::Failsafe.new(
      Flipper::Adapters::Redis.new(Redis.new),
      errors: [Redis::ConnectionError, Redis::TimeoutError]
    )
  end
end

The errors option defaults to [StandardError], which will rescue any exception raised. It is recommended to set it to specific errors that you anticipate could take down your application.

Warning: This adapter will silently swallow the errors that it encounters, including those encountered while updating features (like Flipper.enable :my_feature). You will likely want some other health check in place to notify you of issues.