11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/motor/configs/sync_from_file.rb', line 11
def call(with_exception: false)
MUTEXT.synchronize do
file = Pathname.new(Motor::Configs.file_path)
file_timestamp =
begin
file.ctime
rescue Errno::ENOENT
raise if with_exception
nil
end
next unless file_timestamp
cache_key = file_timestamp.to_s
unless FILE_TIMESTAMPS_STORE.exist?(cache_key)
Motor::Configs::SyncFromHash.call(
YAML.safe_load(file.read, permitted_classes: [Time, Date])
)
true
end
end
end
|