Module: Delayed::Runnable

Included in:
Monitor, Worker
Defined in:
lib/delayed/runnable.rb

Instance Method Summary collapse

Instance Method Details

#startObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/delayed/runnable.rb', line 3

def start
  trap('TERM') { quit! }
  trap('INT') { quit! }

  say "Starting #{self.class.name}"

  Delayed.lifecycle.run_callbacks(:execute, nil) do
    loop do
      run!
      break if stop?
    end
  end
ensure
  on_exit!
end