Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36841 - Switch to Process.clock_gettime for ping #9868

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 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
(current_time - start).to_s
end

def ping_database
start = Time.now
start = current_time
{
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 = current_time
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 = current_time
begin
version = proxy.statuses[:version].version['version']
features = proxy.statuses[:version].version['modules']
Expand Down Expand Up @@ -102,5 +102,9 @@ def plugins_statuses
all.update({ "#{plugin.name}": plugin.status_extension.call })
end
end

def current_time
Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
end
end
end