Class: MediafluxStatus

Inherits:
HealthMonitor::Providers::Base
  • Object
show all
Defined in:
app/models/mediaflux_status.rb

Instance Method Summary collapse

Instance Method Details

#check!Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/mediaflux_status.rb', line 3

def check!
  # Notice that we check Mediaflux status using our TigerData account
  # (rather than the "logged in" user since there is not always a logged
  # in user for the health check)
  Rails.cache.fetch("mediaflux_health_session", expires_in: 5.minutes) do
    logon_request = Mediaflux::LogonRequest.new
    session_token = logon_request.session_token
    if logon_request.error?
      raise logon_request.response_error[:message]
    else
      Mediaflux::LogoutRequest.new(session_token:)
    end
    session_token
  end
end