Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/lib/katello/resources/candlepin/candlepin_ping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ class CandlepinPing < CandlepinResource

class << self
def ping(try_cache: false)
Rails.cache.fetch(CACHE_KEY, expires_in: CACHE_TTL, race_condition_ttl: RACE_TTL, force: !try_cache) do
cache_miss = false
result = Rails.cache.fetch(CACHE_KEY, expires_in: CACHE_TTL, race_condition_ttl: RACE_TTL, force: !try_cache) do
cache_miss = true
::Foreman::Logging.logger('registration').debug "rhsm_status cache=MISS"
response = get('/candlepin/status').body
JSON.parse(response).with_indifferent_access
end
::Foreman::Logging.logger('registration').debug "rhsm_status cache=HIT" unless cache_miss || !try_cache
result
end

def ok?
Expand Down
Loading