diff --git a/apps/dashboard/app/views/batch_connect/sessions/index.html.erb b/apps/dashboard/app/views/batch_connect/sessions/index.html.erb index e916b74597..3b985d31a9 100644 --- a/apps/dashboard/app/views/batch_connect/sessions/index.html.erb +++ b/apps/dashboard/app/views/batch_connect/sessions/index.html.erb @@ -34,7 +34,7 @@ locals: { %>
-
"> +
<% if @sessions.empty? %>

<%= t('dashboard.batch_connect_no_sessions') %>

diff --git a/apps/dashboard/app/views/widgets/_sessions.html.erb b/apps/dashboard/app/views/widgets/_sessions.html.erb index d7bb7a82a8..9cd4858b14 100644 --- a/apps/dashboard/app/views/widgets/_sessions.html.erb +++ b/apps/dashboard/app/views/widgets/_sessions.html.erb @@ -1,6 +1,6 @@ <%- max_sessions = 3 - poll_delay = ENV["POLL_DELAY"] || 10000 + poll_delay = Configuration.sessions_poll_delay active_sessions = BatchConnect::Session.all.reject { |s| s.completed? } session_selection = active_sessions.first(max_sessions) -%> diff --git a/apps/dashboard/config/configuration_singleton.rb b/apps/dashboard/config/configuration_singleton.rb index 3873bc418c..bdf2c5265c 100644 --- a/apps/dashboard/config/configuration_singleton.rb +++ b/apps/dashboard/config/configuration_singleton.rb @@ -368,6 +368,11 @@ def ood_bc_card_time (ood_bc_card_time_int < 0) ? 0 : ood_bc_card_time_int end + def sessions_poll_delay + poll_delay = ENV['POLL_DELAY'] + poll_delay.nil? ? config.fetch(:sessions_poll_delay, '10000') : poll_delay.to_s + end + def config @config ||= read_config end diff --git a/apps/dashboard/test/config/configuration_singleton_test.rb b/apps/dashboard/test/config/configuration_singleton_test.rb index 5f6c452278..e12c7b1a51 100644 --- a/apps/dashboard/test/config/configuration_singleton_test.rb +++ b/apps/dashboard/test/config/configuration_singleton_test.rb @@ -496,4 +496,25 @@ def no_config_env end end end + + test "sessions_poll_delay default value" do + assert_equal('10000', ConfigurationSingleton.new.sessions_poll_delay) + end + + test "sessions_poll_delay reads value from environment" do + with_modified_env('POLL_DELAY': '20000') do + assert_equal('20000', ConfigurationSingleton.new.sessions_poll_delay) + end + end + + test 'sessions_poll_delay reads from config' do + Dir.mktmpdir do |dir| + with_modified_env({ OOD_CONFIG_D_DIRECTORY: dir.to_s }) do + sessions_config = { 'sessions_poll_delay' => '99999' } + File.open("#{dir}/sessions_config.yml", 'w+') { |f| f.write(sessions_config.to_yaml) } + + assert_equal('99999', ConfigurationSingleton.new.sessions_poll_delay) + end + end + end end