Forking worker

nesquena edited this page Dec 28, 2012 · 1 revision

Daniel Farrell introduced the Forking Worker. Use this worker if you want a very simple and easy to use forking processor. With this worker each task is forked out to it's own child process, executed and the process exits.

This manages memory bloat and crashes because the tasks are performed in a child process. In the event that the task crashes or memory runs too high, the child process is cleaned up each time anyways. This should be used instead of the ThreadsOnFork worker when you want to avoid threading and keep things simple (one forked process at a time).

You can select Forking as the default worker for processing with:

Backburner.configure do |config|
  config.default_worker = Backburner::Workers::Forking

or determine the worker on the fly when invoking work:'newsletter_sender', :worker => Backburner::Workers::Forking)

or through the rake tasks with:

$ rake backburner:forking:work