ruby on rails - Daemon eats too much CPU when being idle -
i using blue-daemons fork of daemons gem (since second 1 looks totally abandoned) along daemons-rails gem, wraps daemons rails.
the problem daemon eats cpu when it's idle (10-20 times higher it's performing job).
by being idle, mean have special flag - status.active?
. if status.active?
true
, perform job, if it's false
, sleep 10 secs , iterate next step in while($running) do
block , check status again , again.
i don't want hard stop job because there sensitive data , don't want process break it. there way handle high cpu usaget? tried sidekiq, looks it's primary aim run jobs on demand or on schedule, need daemon run on non-stop basis.
$running = true signal.trap("term") $running = false end while($running) while status.active? ..... lots of work ..... else sleep 10 end end
Comments
Post a Comment