• Alex Kalderimis's avatar
    Handle recursion when creating ApplicationSettings · 4b59d55a
    Alex Kalderimis authored
    This can happen in some situations if we check feature flags before
    the application settings object has been initialized. If that happens,
    we will try to cache the flag states in redis, which causes redis
    metrics to be monitored, which in turn depends on the application
    settings. If there is a flag check at the DB transaction level (or at
    any other point in this chain) we get infinite recursion, which slowly
    causes the stack to overflow (slowly, because there is IO at almost
    every layer of the stack).
    
    Instead, we mark when we try to create application settings, and if
    the method is re-entered, we bail and fall-back to in-memory application
    settings.
    
    Changelog: fixed
    4b59d55a
application_setting.rb 29.3 KB