Skip to content

Commit

Permalink
Fix: browse categories issue when a portal is down + portals status c…
Browse files Browse the repository at this point in the history
…ache expires in 10 minutes (#908)

* make portals status cache expires in 10 minutes

* fix browse categories issue when a portal is down
  • Loading branch information
Bilelkihal authored Jan 9, 2025
1 parent 595ecb9 commit b5989b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ def search_first_instance_id

def keep_only_root_categories(categories)
categories.select do |category|
next unless category.id
category.id.start_with?(rest_url) || category.parentCategory.blank?
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/federation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def canonical_ontology(ontologies)
end

def federation_portal_status(portal_name: nil)
Rails.cache.fetch("federation_portal_up_#{portal_name}", expires_in: 2.hours) do
Rails.cache.fetch("federation_portal_up_#{portal_name}", expires_in: 10.minutes) do
portal_api = federated_portals&.dig(portal_name,:api)
return false unless portal_api
portal_up = false
Expand Down

0 comments on commit b5989b0

Please sign in to comment.