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
|
# File 'lib/resque_kalashnikov/server.rb', line 12
def self.included(base)
base.class_eval do
get "/kalashnikov" do
render_erb 'server/views/catridges.erb'
end
post "/kalashnikov/retry/:status" do
status = params[:status]
klass_name, args = Resque.decode Base64.decode64 params[:request_key]
klass = Resque::Job.constantize klass_name
queue = Resque.queue_from_class(klass)
redis = Redis.connect
redis.rpush "resque:queue:#{queue}", Resque.encode(:class => klass_name, :args => args)
sleep 3 redirect u('/kalashnikov')
end
post "/kalashnikov/reset/:status" do
status = params[:status]
request_key = Base64.decode64 params[:request_key]
redis = Redis.connect
redis.hset "resque:kalashnikov:misfires:#{status}", request_key, 0
redirect u('/kalashnikov')
end
get "/kalashnikov/reset_stats" do
Resque::Catridge.reset_stats
redirect u('/kalashnikov')
end
end
end
|