Files
ubicloud/lib/health_monitor_methods.rb
Jeremy Evans 191bf600f9 Split ResourceMethods, SemaphoreMethods, and HealthMonitorMethods into separate files in lib
This will allow reloading of the files in the future (not enabled
in this commit).

This also found a couple pieces of uncovered code in ResourceMethods,
that were hidden because model.rb is excluded from coverage, so
add specs for them.
2024-12-31 11:25:47 -08:00

16 lines
432 B
Ruby

# frozen_string_literal: true
module HealthMonitorMethods
def aggregate_readings(previous_pulse:, reading:, data: {})
{
reading: reading,
reading_rpt: (previous_pulse[:reading] == reading) ? previous_pulse[:reading_rpt] + 1 : 1,
reading_chg: (previous_pulse[:reading] == reading) ? previous_pulse[:reading_chg] : Time.now
}.merge(data)
end
def needs_event_loop_for_pulse_check?
false
end
end