"OpenStruct has performance issues." \ "Please use Struct or a plain Ruby class instead." elsif openstruct_count < 50 flunk "You removed an OpenStruct. Thank you!" \ "Please update the counter in #{__FILE__}" end "Ratchet" technique 🔧
original_code(args) } e.try { new_code(args) } end Runs every time. Result returned Controlled by feature fl ag Result compared to "use" block Reports metrics of both! Mismatches recorded
users WHERE id = 123 ActiveRecord::Base.connected_to(role: :reading) do User.find(123) end Available since Rails 6.0.0! https://github.com/rails/rails/pull/34052 by @eileencodes
circuit_breaker.success rescue => e circuit_breaker.failure # do fallback end else # do fallback end After a certain number of failures Disallow requests
@circuit_breaker.success ret rescue ConnectionError => e @circuit_breaker.failure raise end else raise CircuitOpenError end end end No fallback, but allows systems to recover