Created
January 21, 2015 17:58
-
-
Save mks-m/04c4670a466b2af85236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EventMachine::PeriodicTimer.new(10) do | |
@redis.keys("*checks*pattern*") do |keys| | |
@redis.get(keys) do |values| | |
values.each do |value| | |
check = MultiJson.load(value) rescue nil | |
next unless check | |
if check[:keepalive] | |
@redis.get("execution:key:#{check[:name]}") do |exec_time| | |
publish_critical if exec_time < Time.now.to_i - check[:keepalive] | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment