just report missing config as nil in log

sharding isn't necessarily set up if this
fires during boot sequence

Change-Id: I2d5448184f141716bd38eb29beef33fe155abdb7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247927
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
Ethan Vizitei 2020-09-17 11:26:23 -05:00
parent 782ef8ef04
commit 0819d3cc80
4 changed files with 0 additions and 16 deletions

View File

@ -16,7 +16,6 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
module Canvas
module Cache
class NilCacheEntry < StandardError; end
# all local cache implementations share a goal of being able to expire
# cache entries before they're actually gone (think credentials expiring soon, etc),
# but to hold onto the stale version just in case.
@ -43,7 +42,6 @@ module Canvas
def write_entry(key, entry, options)
if entry.value.nil?
Rails.logger.warn("[LOCAL_CACHE] Writing nil value for key #{key}")
Canvas::Errors.capture_exception(:local_cache, NilCacheEntry.new("No Config For Key: #{key}"))
end
super(key, entry, options)
forever_entry = entry.dup

View File

@ -15,7 +15,6 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
module Canvas
class DynamicSettings
class AbsentConfigError < StandardError; end
# A class for reading values from Consul
#
# @attr prefix [String] The prefix to be prepended to keys for querying.
@ -110,7 +109,6 @@ module Canvas
return result if result
end
Rails.logger.warn("[DYNAMIC_SETTINGS] config requested which was found no-where (#{key})")
Canvas::Errors.capture_exception(:dynamic_settings, AbsentConfigError.new("No Config For Key: #{key}"))
nil
rescue Imperium::TimeoutError => exception
LocalCache.fetch_without_expiration(CACHE_KEY_PREFIX + keys.first).tap do |val|

View File

@ -42,8 +42,6 @@ module Canvas
.and_return(
Imperium::Testing.kv_not_found_response(options: [:stale])
)
allow(Canvas::Errors).to receive(:capture_exception).with(any_args).and_call_original
expect(Canvas::Errors).to receive(:capture_exception).with(:dynamic_settings, anything)
expect(proxy.fetch('baz')).to be_nil
end

View File

@ -87,15 +87,5 @@ describe LocalCache do
end
end
it "allows writing nil, but will tell on you" do
expect(Canvas::Errors).to receive(:capture_exception) do |message, e|
expect(message).to eq(:local_cache)
end
LocalCache.fetch("never_seen_key") do
# nil on purpose
nil
end
expect(LocalCache.read("never_seen_key")).to be_nil
end
end
end