Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fallback resort to next toggle driver #97

Merged

Conversation

drewdeponte
Copy link
Owner

Why you made the change:

I did this because previously when toggle reconstitution would fail due to a
miss-match, or a missing value, etc. It would simply return a NullToggle. This
short-circuited the process and resulted in the toggle evaluating to false. The
problem was that it was not falling back to the other toggle drivers and
eventually falling back to the defaults held by the in-memory drivers.

I resolved this by modifying the toggle repository get method to check the
success/failure of toggle reconstitution and fall back to the previous toggle
drivers if reconstitution failed. This will make it so that if for any of the
above possible reasons for failure, it will follow the natural driver fallback
path rather than short-circuiting with a NullToggle.

Why you made the change:

I did this because previously when toggle reconstitution would fail due to a
miss-match, or a missing value, etc. It would simply return a NullToggle. This
short-circuited the process and resulted in the toggle evaluating to false. The
problem was that it was not falling back to the other toggle drivers and
eventually falling back to the defaults held by the in-memory drivers.

I resolved this by modifying the toggle repository `get` method to check the
success/failure of toggle reconstitution and fall back to the previous toggle
drivers if reconstitution failed. This will make it so that if for any of the
above possible reasons for failure, it will follow the natural driver fallback
path rather than short-circuiting with a NullToggle.
toggle_data = fetch_toggle_data(id)
return reconstitute_toggle(toggle_data) if toggle_data
Togls::ToggleMissingToggle.new
@drivers.reverse.each do |driver|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use reverse_each here if you want.

@drewdeponte drewdeponte merged commit f2af3ef into master Jun 28, 2016
@drewdeponte drewdeponte deleted the make_fallback_process_fallback_to_next_toggle_driver branch June 28, 2016 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants