* backends:
require active_record in the backend
Move timeout require to appropriate file
Refactor PerformableMethod so it's easier to extend with multiple backends
Remove duplicate class definition in specs
set Delayed::Worker.logger in specs
Make performable method work with Mongo
Update priority in mongo
Added spec for Job#unlock
Implement Job.clear_locks! for mongo
Added spec for Job.clear_locks!
Initial MongoDB backend.
Initial work in allowing different backends to be used in place of ActiveRecord

* moneypools/master:
Bugfix: No update_attribute in mongo_mapper
Pushing new gemspec to make bundler happier
Adding very important indexes. Can't believe I forgot them
Updating MongoMapper backend
Updates to the backend test structure
Conflicts:
delayed_job.gemspec

The problem with using #{RAILS_ROOT}/tmp/pids is that this dir changes with each deploy, so you have to make sure DJ is stopped before deploy and restarted after. Allowing for a pid dir that is stable makes it easier to use monitoring tools like Monit.

* rbriank/master:
added || null to maps for older versions of couchdb
changed to work with the new YAML serialization
remove unneeded methods
use couchrest property default
refactored some methods out
clean up code. removed unneeded parameters
added specs and made them pass for couchrest adapter
added test files but they do not work yet
added couch_rest backend adapter
added code from http://gist.github.com/389006
added skeleton for couchdb

… actually works
The command
$ WORKERS=n RAILS_ENV=production rake jobs:daemon:start
spawns a simple forking daemon, which spawns and restarts `n' instances of
Delayed::Worker. Worker processes are revived by the master process on receipt
of SIGCLD.
We can restart worker instances by sending SIGHUP to the master process or by
killing them directly. Sending SIGTERM, SIGINT, or SIGQUIT to the master
instructs it to kill its children and terminate.
Alternately, there are the tasks `jobs:daemon:restart' and `jobs:daemon:stop'
Two extra features:
* To avoid CPU thrashing, if a child worker dies 4 times in 60 seconds, a
warning message is logged and the child sleeps for 300 seconds before
booting up
* The master polls tmp/restart.txt and restarts children on timestamp update

Thanks to Brandon Keepers and Paul Gideon Dann for reporting that
`Process.kill :TERM, $$' does not work reliably.
For now, we will just exit(0) since that really won't do any harm.
Also, removed unnecessary traps on INT and QUIT.

… the previous implementation, if the raised error has a nil message, it will fail with a `<NoMethodError: undefined method '+' for nil:NilClass>`. Now it is using normal Ruby interpolation that will default to an empty String with nil messages.
Having an exception with a nil message is not a normal Ruby behaviour (Exceptions usually default to its class name when no message is provided), but it is possible. I am experiencing this problem because I am using the Ruby EDAM implementation of a commercial API, that doesn't set a message for its errors. The problem with delayed_job is quite serious, since it makes the jobs worker to crash completely (it kills the process).

* 'master' of https://github.com/jorgemanrubia/delayed_job:
Changed the way the error message is composed when a job fails. Whith the previous implementation, if the raised error has a nil message, it will fail with a `<NoMethodError: undefined method '+' for nil:NilClass>`. Now it is using normal Ruby interpolation that will default to an empty String with nil messages.

+Workers can be running on any computer, as long as they have access to the database and their clock is in sync. Keep in mind that each worker will check the database at least every 5 seconds.

-This will simply create a Delayed::PerformableMethod job in the jobs table which serializes all the parameters you pass to it. There are some special smarts for active record objects

-which are stored as their text representation and loaded from the database fresh when the job is actually run later.

-

-

-h2. Running the jobs

+You can also invoke @rake jobs:work@ which will start working off jobs. You can cancel the rake task with @CTRL-C@.

-You can invoke @rake jobs:work@ which will start working off jobs. You can cancel the rake task with @CTRL-C@.

+h2. Custom Jobs

+

+Jobs are simple ruby objects with a method called perform. Any object which responds to perform can be stuffed into the jobs table. Job objects are serialized to yaml so that they can later be resurrected by the job runner.

+

+<pre>

+class NewsletterJob < Struct.new(:text, :emails)

+ def perform

+ emails.each { |e| NewsletterMailer.deliver_text_to_email(text, e) }

+ end

+end

-You can also run by writing a simple @script/job_runner@, and invoking it externally:

+ table.text :handler # YAML-encoded string of the object that will do work

+ table.text :last_error # reason for last failure (See Note below)

+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.

+ table.datetime :locked_at # Set when a client is working on this object

+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)

+ table.string :locked_by # Who is working on this object (if locked)

+ table.timestamps

+end

+</pre>

+

+On failure, the job is scheduled again in 5 seconds + N ** 4, where N is the number of retries.

+

+The default Worker.max_attempts is 25. After this, the job either deleted (default), or left in the database with "failed_at" set.

+With the default of 25 attempts, the last retry will be 20 days later, with the last interval being almost 100 hours.

+

+The default Worker.max_run_time is 4.hours. If your job takes longer than that, another computer could pick it up. It's up to you to

+make sure your job doesn't exceed this time. You should set this to the longest time you think the job could take.

+

+By default, it will delete failed jobs (and it always deletes successful jobs). If you want to keep failed jobs, set

+Delayed::Worker.destroy_failed_jobs = false. The failed jobs will be marked with non-null failed_at.

+

+By default all jobs are scheduled with priority = 0, which is top priority. You can change this by setting Delayed::Worker.default_priority to something else. Lower numbers have higher priority.

+

+Here is an example of changing job parameters in Rails:

+

+<pre>

+# config/initializers/delayed_job_config.rb

+Delayed::Worker.destroy_failed_jobs = false

+Delayed::Worker.sleep_delay = 60

+Delayed::Worker.max_attempts = 3

+Delayed::Worker.max_run_time = 5.minutes

+</pre>

h3. Cleaning up

You can invoke @rake jobs:clear@ to delete all jobs in the queue.

-h3. Changes

+h2. Mailing List

+

+Join us on the mailing list at http://groups.google.com/group/delayed_job

-* 1.7.0: Added failed_at column which can optionally be set after a certain amount of failed job attempts. By default failed job attempts are destroyed after about a month.

+h2. How to contribute

-* 1.6.0: Renamed locked_until to locked_at. We now store when we start a given job instead of how long it will be locked by the worker. This allows us to get a reading on how long a job took to execute.

+If you find what looks like a bug:

-* 1.5.0: Job runners can now be run in parallel. Two new database columns are needed: locked_until and locked_by. This allows us to use pessimistic locking instead of relying on row level locks. This enables us to run as many worker processes as we need to speed up queue processing.

+# Search the "mailing list":http://groups.google.com/group/delayed_job to see if anyone else had the same issue.

+# Check the "GitHub issue tracker":http://github.com/collectiveidea/delayed_job/issues/ to see if anyone else has reported issue.

+# If you don't see anything, create an issue with information on how to reproduce it.

-* 1.2.0: Added #send_later to Object for simpler job creation

+If you want to contribute an enhancement or a fix:

-* 1.0.0: Initial release

+# Fork the project on github.

+# Make your changes with tests.

+# Commit the changes without making changes to the Rakefile or any other files that aren't related to your enhancement or fix

- s.description ="Delated_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks."

+ s.description ="Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.