diff --git a/app/services/ping.rb b/app/services/ping.rb index e24fbabdc99..c7386bee8c8 100644 --- a/app/services/ping.rb +++ b/app/services/ping.rb @@ -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), @@ -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, @@ -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'] @@ -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