Class: Kabutops::Watchdog
Class Method Summary
collapse
Instance Method Summary
collapse
callbacks, notify
#append_features, #included
#logger
Class Method Details
.check ⇒ Object
17
18
19
|
# File 'lib/kabutops/watchdog.rb', line 17
def check
new.check
end
|
.check! ⇒ Object
13
14
15
|
# File 'lib/kabutops/watchdog.rb', line 13
def check!
perform_async
end
|
.loop ⇒ Object
21
22
23
24
25
26
|
# File 'lib/kabutops/watchdog.rb', line 21
def loop
loop do
sleep self.params[:wait] || 5
check
end
end
|
Instance Method Details
#check ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/kabutops/watchdog.rb', line 29
def check
logger.info "#{self.class} check started"
outdated_resources.each do |resource|
resource.update(scheduled_update_at: Time.now.to_i)
adapters.each do |adapter|
adapter.store(resource)
end
self.class.notify(:on_outdated, resource)
end
logger.info "#{self.class} check finished"
end
|
45
46
47
48
49
|
# File 'lib/kabutops/watchdog.rb', line 45
def perform
check
sleep self.class.params[:wait] || 5
self.class.perform_async
end
|