Class: ResqueWeb::Plugins::ResqueScheduler::DelayedController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ResqueWeb::Plugins::ResqueScheduler::DelayedController
- Defined in:
- app/controllers/resque_web/plugins/resque_scheduler/delayed_controller.rb
Overview
Controller for delayed jobs. These have been added to the queue by the application, so here, they can be run immediately, deleted from the queue, or rescheduled.
Instance Method Summary collapse
-
#cancel_now ⇒ Object
POST /delayed/cancel_now cancels a specific job based on klass, timestamp and args.
-
#clear ⇒ Object
POST /delayed/clear.
-
#index ⇒ Object
GET /delayed.
-
#jobs_klass ⇒ Object
GET /delayed/jobs/:klass Shows us all of the timestamps where jobs of this type, with these args are currently scheduled as delayed jobs.
-
#queue_now ⇒ Object
POST /delayed/queue_now Sends ALL of the delayed jobs at a particular timestamp to the queue, regardless of their details.
-
#search ⇒ Object
POST /delayed/search.
-
#timestamp ⇒ Object
GET /delayed/:timestamp.
Instance Method Details
#cancel_now ⇒ Object
POST /delayed/cancel_now cancels a specific job based on klass, timestamp and args.
43 44 45 46 47 48 49 |
# File 'app/controllers/resque_web/plugins/resque_scheduler/delayed_controller.rb', line 43 def cancel_now klass = Resque::Scheduler::Util.constantize(params['klass']) = params['timestamp'] args = Resque.decode params['args'] Resque.(, klass, *args) redirect_to Engine.app.url_helpers.delayed_path end |
#clear ⇒ Object
POST /delayed/clear
52 53 54 55 |
# File 'app/controllers/resque_web/plugins/resque_scheduler/delayed_controller.rb', line 52 def clear Resque.reset_delayed_queue redirect_to Engine.app.url_helpers.delayed_path end |
#index ⇒ Object
GET /delayed
9 10 11 12 13 14 |
# File 'app/controllers/resque_web/plugins/resque_scheduler/delayed_controller.rb', line 9 def index @start = params[:start].to_i @number_to_show = 20 @total_number_of_delayed_jobs = Resque.delayed_queue_schedule_size @timestamps = Resque.delayed_queue_peek(@start, @number_to_show) end |
#jobs_klass ⇒ Object
GET /delayed/jobs/:klass Shows us all of the timestamps where jobs of this type, with these args are currently scheduled as delayed jobs. Accessed by clicking the ‘All schedules’ link next to a delayed job.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/resque_web/plugins/resque_scheduler/delayed_controller.rb', line 20 def jobs_klass klass = Resque::Scheduler::Util.constantize(params[:klass]) @args = params[:args] ? JSON.load(URI.decode(params[:args])) : [] if this_is_the_activejob_wrapper(klass) # @timestamps = get_timestamps_for_activejob_wrapper(klass) @timestamps = ActiveJobWrapperTimestampFinder.new(@args).perform else @timestamps = Resque.scheduled_at(klass, *@args) end rescue # Should this be a rescue? Seems to cover the case of the params # not validating or something. @timestamps = [] end |
#queue_now ⇒ Object
POST /delayed/queue_now Sends ALL of the delayed jobs at a particular timestamp to the queue, regardless of their details.
60 61 62 63 64 65 66 |
# File 'app/controllers/resque_web/plugins/resque_scheduler/delayed_controller.rb', line 60 def queue_now = params['timestamp'].to_i if > 0 Resque::Scheduler.() end redirect_to ResqueWeb::Engine.app.url_helpers.overview_path end |