Skip to content

Commit

Permalink
Fixes #36841 - Switch to Process.clock_gettime for ping
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Oct 18, 2023
1 parent 2ae0516 commit cc77223
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/services/ping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def statuses
private

def duration_ms(start)
((Time.new - start) * 1000).round.to_s
((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round.to_s
end

def ping_database
start = Time.now
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
{
active: ActiveRecord::Base.connection.active?,
duration_ms: duration_ms(start),
Expand All @@ -50,7 +50,7 @@ def ping_database
def statuses_compute_resources
results = []
ComputeResource.all.index.map do |resource|
start = Time.now
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
errors = resource.ping
results << {
name: resource.name,
Expand All @@ -65,7 +65,7 @@ def statuses_compute_resources
def statuses_smart_proxies
results = []
SmartProxy.all.includes(:features).map do |proxy|
start = Time.now
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
begin
version = proxy.statuses[:version].version['version']
features = proxy.statuses[:version].version['modules']
Expand Down

0 comments on commit cc77223

Please sign in to comment.