resque-durable 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ module Resque
26
26
  }
27
27
 
28
28
  named_scope :failed, lambda {
29
- { :conditions => [ 'completed_at is null AND timeout_at < ?', Time.now.utc ], :order => 'timeout_at asc' }
29
+ { :conditions => [ 'completed_at is null AND timeout_at < ?', Time.now.utc ], :order => 'timeout_at asc', :limit => 500 }
30
30
  }
31
31
 
32
32
  named_scope :complete, lambda {
@@ -36,7 +36,14 @@ module Resque
36
36
  module Recovery
37
37
 
38
38
  def recover
39
- failed.all(:limit => 500).each { |audit| audit.enqueue if audit.retryable? }
39
+ failed.each do |audit|
40
+ begin
41
+ audit.enqueue if audit.retryable?
42
+ rescue => e
43
+ message = "#{e.class.name}: #{e.message}\n#{(e.backtrace || []).join("\n")}"
44
+ logger && logger.error("Failed to retry audit #{audit.enqueued_id}: #{message}")
45
+ end
46
+ end
40
47
  end
41
48
 
42
49
  def cleanup(date)
@@ -46,7 +53,6 @@ module Resque
46
53
  end
47
54
  extend Recovery
48
55
 
49
-
50
56
  def self.initialize_by_klass_and_args(job_klass, args)
51
57
  new(:job_klass => job_klass, :payload => args, :enqueued_id => GUID.generate)
52
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-durable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-08 00:00:00.000000000 Z
13
+ date: 2012-07-16 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description:
16
16
  email: