Skip to content

Instantly share code, notes, and snippets.

@kwstannard
Last active August 29, 2015 14:06
Show Gist options
  • Save kwstannard/7be9de2ba5ed875c0c66 to your computer and use it in GitHub Desktop.
Save kwstannard/7be9de2ba5ed875c0c66 to your computer and use it in GitHub Desktop.
auto disable failing features if they break
#pseudo code
class Rollout
def auto_disable(feature, user, feature_block, old_block)
if active?(feature, user)
begin
yield feature_block
rescue => e
deactivate(feature)
raise e
end
else
yield old_block
end
end
end
features = Rollout.new
feature = -> { raise if [0,1].sample == 0 }
old = -> { "old code" }
features.auto_disable(:chat, lender, feature, old, &:call)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment