5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/resque-retry/server.rb', line 5
def self.included(base)
base.class_eval {
helpers do
def retry_key_for_job(job)
klass = Resque.constantize(job['class'])
if klass.respond_to?(:redis_retry_key)
klass.redis_retry_key(job['args'])
else
nil
end
end
def retry_attempts_for_job(job)
Resque.redis.get(retry_key_for_job(job))
end
def retry_failure_details(retry_key)
Resque.decode(Resque.redis["failure_#{retry_key}"])
end
def local_template(path)
File.read(File.join(File.dirname(__FILE__), "server/views/#{path}"))
end
end
get '/retry' do
erb local_template('retry.erb')
end
get '/retry/:timestamp' do
erb local_template('retry_timestamp.erb')
end
}
end
|