From 89a9f28033971dae7115016481cf1301306c326f Mon Sep 17 00:00:00 2001 From: Simon Williams Date: Thu, 10 Sep 2020 09:58:01 -0600 Subject: [PATCH] add debugging around potential request throttle config issue refs FOO-949 test plan: requests succeed with request_throttle config in place Change-Id: If882cc683fbfcb6b2be9c87827934506203df55d Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247320 Tested-by: Service Cloud Jenkins Reviewed-by: Cody Cutrer QA-Review: Cody Cutrer Product-Review: Cody Cutrer --- app/middleware/request_throttle.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/middleware/request_throttle.rb b/app/middleware/request_throttle.rb index 5b87623cca5..7ab6687f519 100644 --- a/app/middleware/request_throttle.rb +++ b/app/middleware/request_throttle.rb @@ -193,7 +193,18 @@ class RequestThrottle end def self.dynamic_settings - @dynamic_settings ||= YAML.safe_load(Canvas::DynamicSettings.find(tree: :private)['request_throttle.yml'] || '') || {} + @dynamic_settings ||= begin + yml_config = Canvas::DynamicSettings.find(tree: :private)['request_throttle.yml'] + res = YAML.safe_load(yml_config || '') || {} + if res == true + Rails.logger.error("ERROR: invalid value #{yml_config} from DynamicSettings resulted in `true` result") + cache_contents = LocalCache.cache.instance_variable_get(:@data)&.map{ |k,v| + [k,v] if k.include?("request_throttle") + }&.compact + Rails.logger.error("LocalCache contents for request_throttle: #{cache_contents.to_s}") + end + res + end end def rate_limit_exceeded