Commit 78735659 authored by Alex Kalderimis's avatar Alex Kalderimis

Add explanatory comment

parent 4b59d55a
......@@ -660,6 +660,10 @@ class ApplicationSetting < ApplicationRecord
Recursion = Class.new(RuntimeError)
def self.create_from_defaults
# this is posssible if calls to create the record depend on application
# settings themselves. This was seen in the case of a feature flag called by
# `transaction` that ended up requiring application settings to determine metrics behavior.
# If something like that happens, we break the loop here, and let the caller decide how to manage it.
raise Recursion if Thread.current[:application_setting_create_from_defaults]
Thread.current[:application_setting_create_from_defaults] = true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment