Skip to content

Commit 4c8cc9c

Browse files
don't save error status for internal calls
1 parent 29aec2e commit 4c8cc9c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/ontologies_api_client/request_federation.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def federated_get(params = {}, &link)
3232
HTTP.get(link.call(conn.url_prefix.to_s.chomp('/')), portal_params, connection: conn)
3333
rescue Exception => e
3434
HTTP.log("Error in federation #{portal_name} is down status cached for 10 minutes")
35+
Rails.cache.write("federation_portal_up_#{portal_name}", false, expires_in: 10.minutes) unless internal_call?(conn)
3536
[OpenStruct.new(errors: "Problem retrieving #{link.call(conn.url_prefix.to_s.chomp('/')) || conn.url_prefix}")]
3637
end
3738
end
@@ -61,6 +62,9 @@ def request_portals(params = {})
6162
portals
6263
end
6364

65+
def internal_call?(conn)
66+
conn.url_prefix.to_s.start_with?(LinkedData::Client::HTTP.conn.url_prefix.to_s)
67+
end
6468

6569
def portal_name_from_id(id)
6670
LinkedData::Client::HTTP.federated_conn.find { |_, value| value.url_prefix.to_s.eql?(id) }&.first || ''

0 commit comments

Comments
 (0)