fix exit! issues once and for all, robustify god load
[god.git] / test / configs / child_polls / child_polls.god
blobc563ad4b1358c5f24f2ed31057f2f4918713e070
1 God.watch do |w|
2   w.name = 'child-polls'
3   w.start = File.join(GOD_ROOT, *%w[test configs child_polls simple_server.rb])
4   w.interval = 5
5   w.grace = 2
6   
7   w.start_if do |start|
8     start.condition(:process_running) do |c|
9       c.running = false
10     end
11   end
12   
13   w.restart_if do |restart|
14     restart.condition(:cpu_usage) do |c|
15       c.above = 30.percent
16       c.times = [3, 5]
17     end
18     
19     restart.condition(:memory_usage) do |c|
20       c.above = 10.megabytes
21       c.times = [3, 5]
22     end
23   end
24   
25   # lifecycle
26   w.lifecycle do |on|
27     on.condition(:flapping) do |c|
28       c.to_state = [:start, :restart]
29       c.times = 3
30       c.within = 60.seconds
31       c.transition = :unmonitored
32       c.retry_in = 10.seconds
33       c.retry_times = 2
34       c.retry_within = 5.minutes
35     end
36   end
37 end