Permalink
Browse files

Silenced the wrong AR call...

  • Loading branch information...
1 parent c54f748 commit 6d611828e0e04028117f0993909c9c5fb0d29ee7 @ragalie committed Aug 18, 2011
Showing with 6 additions and 7 deletions.
  1. +6 −7 lib/workling/clients/active_record_client.rb
@@ -53,15 +53,14 @@ def request(key, value)
def retrieve(key)
namespace = Workling.config[:namespace] || ""
key = namespace + ":" + key
- job = WorklingJob.find(:first,
- :conditions => ["queue = ? AND status IS NULL", key])
-
+ ActiveRecord::Base.silence do
+ job = WorklingJob.find(:first,
+ :conditions => ["queue = ? AND status IS NULL", key])
+ end
+
# Need to use update_all and check return value to avoid deadlock
if job
- count = nil
- ActiveRecord::Base.silence do
- count = WorklingJob.update_all ["status = ?", "processing"], ["id = ?", job.id]
- end
+ count = WorklingJob.update_all ["status = ?", "processing"], ["id = ?", job.id]
if count == 1
status = Thread.current[:status]

0 comments on commit 6d61182

Please sign in to comment.