def feed
daemon do
gen_pidfile
@main.init_logging
@logger = @main.logger
set_q
@pid = Process::pid
@cmd = @main.cmd
@started = Util::timestamp
@min_sleep = Integer(@options['min_sleep'] || defval('min_sleep'))
@max_sleep = Integer(@options['max_sleep'] || defval('max_sleep'))
@max_feed = Integer(@options['max_feed'] || defval('feed'))
@children = Hash::new
@jrd = JobRunnerDaemon::daemon
install_signal_handlers
info{ "** STARTED **" }
info{ "version <#{ RQ::VERSION }>" }
info{ "cmd <#{ @cmd }>" }
info{ "pid <#{ @pid }>" }
info{ "pidfile <#{ @pidfile.path }>" }
info{ "jobrunnerdaemon uri <#{ @jrd.uri }> pid <#{ @jrd.pid }>" }
info{ "qpath <#{ @qpath }>" }
debug{ "mode <#{ @mode }>" }
debug{ "max_feed <#{ @max_feed }>" }
debug{ "min_sleep <#{ @min_sleep }>" }
debug{ "max_sleep <#{ @max_sleep }>" }
fill_morgue
loop do
handle_signal if $rq_signaled
throttle(@min_sleep) do
start_jobs unless busy?
if nothing_running?
relax
else
reap_jobs
end
end
end
end
end