Module: ResqueRetry::Server

Defined in:
lib/resque-retry/server.rb

Defined Under Namespace

Modules: Helpers

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Adds `resque-retry` web interface elements to `resque-web`


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
# File 'lib/resque-retry/server.rb', line 12

def self.included(base)
  base.class_eval {

    get '/retry' do
      erb local_template('retry.erb')
    end

    get '/retry/:timestamp' do
      erb local_template('retry_timestamp.erb')
    end

    post '/retry/:timestamp/remove' do
      Resque.delayed_timestamp_peek(params[:timestamp], 0, 0).each do |job|
        cancel_retry(job)
      end
      redirect u('retry')
    end

    post '/retry/:timestamp/jobs/:id/remove' do
      job = Resque.decode(params[:id])
      cancel_retry(job)
      redirect u("retry/#{params[:timestamp]}")
    end
  }
end