god icon indicating copy to clipboard operation
god copied to clipboard

Beefed up Complex test method

Open pedz opened this issue 14 years ago • 2 comments

I got my Rails processes (using thin) to wait until beanstalkd is running. The recipe I used is:

w.start_if do |start|
  start.condition(:complex) do |c|
    c.interval = 1.minute
    c.this(:process_running) do |p|
      p.running = false
    end
    c.and(:process_running) do |p|
      p.pid_file = $beanstalkd.pid_file
      p.running = true
    end
  end
end

The way I start beanstalkd is:

w.pid_file = w.pid_file
w.start = "/usr/local/bin/beanstalkd & echo $! > #{w.pid_file}"

If the start is slow (I added a sleep in front of it), the pid file doesn't exist and I was have problems with Complex throwing errors. I now catch the errors and assume the test is "false" in that case. It probably should chnage it so that nothing is thrown but this got me working.

If I start beanstalkd the recommended way of not setting the pid file I get some sort of hang due to locking issues. That may be a Ruby bug. I am using Ruby 1.9.1 p378. I'll do some more experimenting and see if I can strengthen it up a bit.

Is God dead? The google groups looks like a ghost town. Is there a new kid on the block? With the current level of documentation (basically the single front page), doing anything unusual (like using Complex) requires a lot of work. And the code is not well documented so it makes it hard. It kinda seems like someone's freshman project. I'm surprised so many people suggested I use it.

pedz avatar Jun 19 '11 19:06 pedz

Lots of people are still using god. Most of the people who are using it are still on 1.8, so I'm not sure of the state of the 1.9 support.

eric avatar Jun 19 '11 20:06 eric

I'll be helping Eric and Tom to get up to date with Ruby 1.9. God is far from dead, it just needs lots of loving. Please remember though that Ruby 1.9.1 is a buggy release and has been known to randomly break applications. Any 1.9 compatible work made to God will be tested against 1.9.2

leejarvis avatar Jun 22 '11 21:06 leejarvis