Skip to content

Instantly share code, notes, and snippets.

@mks-m
Created January 21, 2015 17:58
Show Gist options
  • Save mks-m/04c4670a466b2af85236 to your computer and use it in GitHub Desktop.
Save mks-m/04c4670a466b2af85236 to your computer and use it in GitHub Desktop.
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