Skip to content

Commit

Permalink
fixes #10343 - only log cache deletion failures when saving settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Cleal authored and dLobatog committed May 5, 2015
1 parent 245180f commit 83bd400
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ def clear_value_when_default
def clear_cache
# ensures we don't have cache left overs in settings
Rails.logger.debug "removing #{name} from cache"
Setting.cache.delete(name.to_s)
if Setting.cache.delete(name.to_s) == false
Rails.logger.warn "Failed to remove #{name} from cache"
end
end

def readonly_when_overridden_in_SETTINGS
Expand Down
5 changes: 5 additions & 0 deletions test/unit/setting_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ class CustomSetting < Setting
assert_equal s.category, "Setting::Auth"
end

test "create succeeds when cache is non-functional" do
Setting.cache.expects(:delete).with('test_broken_cache').returns(false)
assert_valid Setting.create!(:name => 'test_broken_cache', :description => 'foo', :default => 'default')
end

private

def check_parsed_value(settings_type, expected_value, string_value)
Expand Down

0 comments on commit 83bd400

Please sign in to comment.