Skip to content

Instantly share code, notes, and snippets.

@slumos
Created December 17, 2008 19:25
Show Gist options
  • Save slumos/37178 to your computer and use it in GitHub Desktop.
Save slumos/37178 to your computer and use it in GitHub Desktop.
#restart if memory or cpu is too high
w.transition(:up, :restart) do |on|
if type == :mongrel then
on.condition(:memory_usage) do |c|
c.above = 250.megabytes
c.times = [9,10]
end
on.condition(:memory_usage) do |c|
c.above = 300.megabytes
end
else
on.condition(:memory_usage) do |c|
c.above = 400.megabytes
c.times = [9, 10]
end
end
on.condition(:cpu_usage) do |c|
c.interval = 30
c.above = 50.percent
c.times = 10
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment