Skip to content

Commit

Permalink
Systemstatus poll config (#3595)
Browse files Browse the repository at this point in the history
* Add system status poll delay configuration

* fix formatting

* use configured poll delay in javascript
  • Loading branch information
ashton22305 authored Jun 7, 2024
1 parent 63a5f36 commit 56e2140
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions apps/dashboard/app/javascript/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export function bcIndexUrl() {
return cfgData['bcIndexUrl'];
}

export function statusPollDelay() {
const cfgData = configData();
return Number(cfgData['statusPollDelay']);
}

export function statusIndexUrl() {
const cfgData = configData();
return cfgData['statusIndexUrl'];
Expand Down
7 changes: 3 additions & 4 deletions apps/dashboard/app/javascript/system_status.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { statusIndexUrl } from './config'
import { statusIndexUrl, statusPollDelay } from './config'
import { pollAndReplace } from './turbo_shim'

jQuery(() => {
pollDelay = 30000;
pollAndReplace(statusIndexUrl(), pollDelay, "system-status");
})
pollAndReplace(statusIndexUrl(), statusPollDelay(), "system-status");
});
1 change: 1 addition & 0 deletions apps/dashboard/app/views/layouts/_config.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
data-base-analytics-path="<%= analytics_path('delme').gsub(/[\/]*delme[\/]*/,'') %>"
data-bc-poll-delay="<%= Configuration.bc_sessions_poll_delay %>"
data-bc-index-url="<%= batch_connect_sessions_path %>"
data-status-poll-delay="<%= Configuration.status_poll_delay %>"
data-status-index-url="<%= system_status_path %>"
></div>
8 changes: 8 additions & 0 deletions apps/dashboard/config/configuration_singleton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,14 @@ def ood_bc_card_time
(ood_bc_card_time_int < 0) ? 0 : ood_bc_card_time_int
end

# Returns the number of milliseconds to wait between calls to the system status page
# The default is 30s and the minimum is 10s.
def status_poll_delay
status_poll_delay = ENV['STATUS_POLL_DELAY']
status_poll_delay_int = status_poll_delay.nil? ? config.fetch(:status_delay, '30000').to_i : status_poll_delay.to_i
status_poll_delay_int < 10_000 ? 10_000 : status_poll_delay_int
end

# Returns the number of milliseconds to wait between calls to the BatchConnect Sessions resource
# to update the sessions card information.
# The default and minimum value is 10s = 10_000
Expand Down

0 comments on commit 56e2140

Please sign in to comment.