Sha256: 35d7a5d4fb03c5144d448e9248efdcfa5db738fb8b3162c9cbca8bac484931ff

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

God.watch do |w|
  w.name = 'degrading-lambda'
  w.start = File.join(File.dirname(__FILE__), *%w[tcp_server.rb])
  w.interval = 5
  w.grace = 2
  w.uid = 'kev'
  w.gid = 'kev'
  w.group = 'test'
  
  w.start_if do |start|
    start.condition(:process_running) do |c|
      c.running = false
    end
  end
  
  w.restart_if do |restart|
    restart.condition(:degrading_lambda) do |c|
      require 'socket'
      c.lambda = lambda {
        begin
          sock = TCPSocket.open('127.0.0.1', 9090)
          sock.send "2\n", 0
          retval = sock.gets
          puts "Retval is #{retval}"
          sock.close
          retval
        rescue
          false
        end
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
god-0.4.3 test/configs/degrading_lambda/degrading_lambda.god
god-0.4.0 test/configs/degrading_lambda/degrading_lambda.god
god-0.4.1 test/configs/degrading_lambda/degrading_lambda.god