kbaum-resque-retry 0.0.5 → 0.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/resque-retry.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'resque/failure/multiple'
|
2
|
+
|
3
|
+
module ResqueRetry
|
4
|
+
class RetryFailureBackend < Resque::Failure::Multiple
|
5
|
+
|
6
|
+
include Resque::Helpers
|
7
|
+
|
8
|
+
def save
|
9
|
+
unless retrying?
|
10
|
+
super
|
11
|
+
else
|
12
|
+
data = {
|
13
|
+
:failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S"),
|
14
|
+
:payload => payload,
|
15
|
+
:exception => exception.class.to_s,
|
16
|
+
:error => exception.to_s,
|
17
|
+
:backtrace => Array(exception.backtrace),
|
18
|
+
:worker => worker.to_s,
|
19
|
+
:queue => queue
|
20
|
+
}
|
21
|
+
data = Resque.encode(data)
|
22
|
+
Resque.redis[failure_key]=data
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def retrying?
|
29
|
+
Resque.redis.get(retry_key)
|
30
|
+
end
|
31
|
+
|
32
|
+
def failure_key
|
33
|
+
"failure_#{retry_key}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def retry_key
|
37
|
+
klass.redis_retry_key(payload["args"])
|
38
|
+
end
|
39
|
+
|
40
|
+
def klass
|
41
|
+
constantize(payload["class"])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<% if job && delayed_timestamp_size == 1 %>
|
33
33
|
<%= h(job['class']) %>
|
34
34
|
<% else %>
|
35
|
-
<a href="<%= url "
|
35
|
+
<a href="<%= url "retry/#{timestamp}" %>">see details</a>
|
36
36
|
<% end %>
|
37
37
|
</td>
|
38
38
|
<td><%= h(job['args'].inspect) if job && delayed_timestamp_size == 1 %></td>
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kbaum-resque-retry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 89
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- 5
|
10
|
-
|
10
|
+
- 1
|
11
|
+
version: 0.0.5.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Luke Antins
|
@@ -16,7 +17,7 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2010-07-
|
20
|
+
date: 2010-07-13 00:00:00 -04:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
@@ -100,7 +101,7 @@ files:
|
|
100
101
|
- test/test_jobs.rb
|
101
102
|
- lib/resque/plugins/exponential_backoff.rb
|
102
103
|
- lib/resque/plugins/retry.rb
|
103
|
-
- lib/resque/
|
104
|
+
- lib/resque-retry/retry_failure_backend.rb
|
104
105
|
- lib/resque-retry/server/views/retry.erb
|
105
106
|
- lib/resque-retry/server/views/retry_timestamp.erb
|
106
107
|
- lib/resque-retry/server.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'resque/failure/multiple'
|
2
|
-
|
3
|
-
class RetryFailureBackend < Resque::Failure::Multiple
|
4
|
-
|
5
|
-
include Resque::Helpers
|
6
|
-
|
7
|
-
def save
|
8
|
-
unless retrying?
|
9
|
-
super
|
10
|
-
else
|
11
|
-
data = {
|
12
|
-
:failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S"),
|
13
|
-
:payload => payload,
|
14
|
-
:exception => exception.class.to_s,
|
15
|
-
:error => exception.to_s,
|
16
|
-
:backtrace => Array(exception.backtrace),
|
17
|
-
:worker => worker.to_s,
|
18
|
-
:queue => queue
|
19
|
-
}
|
20
|
-
data = Resque.encode(data)
|
21
|
-
Resque.redis[failure_key]=data
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
protected
|
26
|
-
|
27
|
-
def retrying?
|
28
|
-
Resque.redis.get(retry_key)
|
29
|
-
end
|
30
|
-
|
31
|
-
def failure_key
|
32
|
-
"failure_#{retry_key}"
|
33
|
-
end
|
34
|
-
|
35
|
-
def retry_key
|
36
|
-
klass.redis_retry_key(payload["args"])
|
37
|
-
end
|
38
|
-
|
39
|
-
def klass
|
40
|
-
constantize(payload["class"])
|
41
|
-
end
|
42
|
-
end
|