When I tried to upgrade rails to version 3.2.2 (from version 3.1.3), I notice that when a job failed it was run a second time right away.
The cause of this problem is that the job is not being unlocked correctly. I found an old issue that had the same problem here: collectiveidea/delayed_job#63.
What I found is that when first locking the job, only the locks on the database are changed, not those of the object itself, so when the job is unlocked, the locked_by and locked_at attributes are not correctly updated.
I managed to work around the issue by calling self.reload instead of :
self.locked_at = now
self.locked_by = worker
This fix may cause a performance issue, and there is probably a better/cleaner way to solve this.
rails version 3.2.2
delayed_job version 3.0.1
delayed_job_active_record version 0.3.2
using SQLite3 (gem 1.3.5)
Can you please verify whether this is fixed in the latest gem version (0.4.4)?