Class: I2X::Checkup
- Inherits:
-
Object
- Object
- I2X::Checkup
- Defined in:
- lib/i2x/checkup.rb
Instance Method Summary collapse
-
#check(schedule) ⇒ Object
Initiate real-time (poll) check.
-
#execute(agent) ⇒ Object
Perform the actual check execution.
Instance Method Details
#check(schedule) ⇒ Object
Initiate real-time (poll) check
+ schedule: the scheduling being checked
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/i2x/checkup.rb', line 23 def check schedule Integration.all.each do |integration| @agents = integration.agents.where( :schedule => schedule).where("last_check_at < CURRENT_TIMESTAMP - INTERVAL 5 MINUTE") @agents.each do |agent| begin self.execute agent rescue Exception => e end end end end |
#execute(agent) ⇒ Object
Perform the actual check execution
+ agent: the agent to verify
9 10 11 12 13 14 15 16 |
# File 'lib/i2x/checkup.rb', line 9 def execute agent begin @response = agent.execute rescue Exception => e @response = {:status => 400, :error => e} end end |