![]() Later in the flow, when processing payment, we also needed to vary behaviour. new else LegacyPaymentProvider :: Session. enabled? ( :new_payment_provider, user ) NewPaymentProvider :: Session. save render json:, status: :created else head :unprocessable_entity end end end end # Factory module Payment class SessionFactory def self. ![]() # Controller module Payment class SessionsController < ApplicationController def create = SessionFactory. This meant that we could use a factory object in our payment sessions controller to determine which provider to use based on the state of the feature flag when the user initiated payment. We were fortunate that the first step in both our legacy and new payment flows was to create a payment session with the provider. Such patterns also help us to reduce the number of changes we need to make to our code, reducing the surface for potential bugs. One tactic to minimize this is the use of structural design patterns that enable us to concentrate behaviour variation in fewer places. The excellent Flipper gem provides a straightforward means of adding flags to your application, as well as a helpful web UI that can allow admin users to control them.Ī potential downside of feature flags is the need to introduce conditionals throughout your code at points where behaviour will vary depending on the state of the flag. This allowed us to monitor the impact of the change whilst carefully managing the risk. When the time came to enable the new integration, we did so gradually, initially just for 1% of users. Using a feature flag to control access to our changes enabled internal users to test them incrementally too. Once a feature is deployed, flags also give us control over when to enable it, and for which users.Ĭhanging the payment provider was a large and complex change, so being able to review and merge smaller changes as we worked made development easier. Below are some techniques we used to reduce the risks attending this significant change, and to ensure that the migration went smoothly.įeature flags enable us to test and integrate changes continuously and incrementally, reducing the risk of deploying a single large change in one go. We recently replaced a payment integration for a client with an online ordering system processing tens of thousands of orders per day. For a successful service with many users, unexpected downtime can be extremely costly. There comes a point in the life of an application, however, when this trade-off is no longer acceptable. Early adopters may tolerate some instability as the price of rapid innovation. For a new product, you might choose to prioritise speed of development over reliability as you iterate quickly and learn more about your users’ needs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |