Class: ProcessSettings::Watchdog
- Inherits:
-
Object
- Object
- ProcessSettings::Watchdog
- Defined in:
- lib/process_settings/helpers/watchdog.rb
Defined Under Namespace
Classes: OutOfSync
Constant Summary collapse
- MAX_MTIME_DIFFERENCE =
2.minutes
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(process_settings_file_path) ⇒ Watchdog
constructor
A new instance of Watchdog.
Constructor Details
#initialize(process_settings_file_path) ⇒ Watchdog
Returns a new instance of Watchdog.
11 12 13 |
# File 'lib/process_settings/helpers/watchdog.rb', line 11 def initialize(process_settings_file_path) @process_settings_file_path = process_settings_file_path or raise ArgumentError, "process_settings_file_path must be passed" end |
Instance Method Details
#check ⇒ Object
15 16 17 18 19 |
# File 'lib/process_settings/helpers/watchdog.rb', line 15 def check if version_from_memory != version_from_disk && (Time.now - mtime_from_disk) > MAX_MTIME_DIFFERENCE raise OutOfSync.new("ProcessSettings versions are out of sync!\n Version from Disk: #{version_from_disk}\n Version from Memory: #{version_from_memory}\n mtime of file: #{mtime_from_disk}") end end |