module ResqueRetry::Server

Public Class Methods

included(base) click to toggle source

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

@api private

# 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