Skip to content

Commit

Permalink
Making generic AR catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Malinconico committed Oct 7, 2013
1 parent 9b4af3d commit 803735a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/delayed/backend/active_record.rb
Expand Up @@ -75,7 +75,7 @@ def lock_exclusively!(max_run_time, worker)
# We don't own this job so we will update the locked_by name and the locked_at
begin
self.class.update_all(["locked_at = ?, locked_by = ?", now, worker], ["id = ? and (locked_at is null or locked_at < ?) and (run_at <= ?)", id, (now - max_run_time.to_i), now])
rescue ActiveRecord::StatementInvalid => e
rescue Exception => e
if e.message =~ /Deadlock found when trying to get lock/
0
else
Expand Down

0 comments on commit 803735a

Please sign in to comment.