5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/rails_nexus/database_health_controller.rb', line 5
def index
@period = params[:period]&.to_i || 7
@period = [@period, 1].max
@period = [@period, 90].min
time_range = @period.days.ago..Time.current
@pool_by_error = collect_pool_by_error(time_range)
@summary = collect_summary(time_range)
@live_pool = collect_live_pool
@peak_utilization = @pool_by_error.map { |e| e[:utilization] }.max || 0
@total_dead = @pool_by_error.sum { |e| e[:dead] }
@total_waiting = @pool_by_error.sum { |e| e[:waiting] }
end
|