Class: Flightdeck::RecurringTasksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Flightdeck::RecurringTasksController
- Includes:
- Toasts
- Defined in:
- app/controllers/flightdeck/recurring_tasks_controller.rb
Constant Summary
Constants inherited from ApplicationController
ApplicationController::UNCONFIGURED_MESSAGE
Instance Method Summary collapse
- #index ⇒ Object
-
#run ⇒ Object
"Run now" is the task's own enqueue, so the recurring execution is recorded exactly as the scheduler would have recorded it.
Methods inherited from ApplicationController
Instance Method Details
#index ⇒ Object
9 10 |
# File 'app/controllers/flightdeck/recurring_tasks_controller.rb', line 9 def index end |
#run ⇒ Object
"Run now" is the task's own enqueue, so the recurring execution is recorded exactly as the scheduler would have recorded it.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/flightdeck/recurring_tasks_controller.rb', line 14 def run row = @catalog.find(params[:id]) return missing unless row active_job = row.task.enqueue(at: Time.current) load_catalog if active_job @enqueued_job_id = active_job.try(:provider_job_id) toast "Enqueued #{row.key}#{job_reference}." else toast "#{row.key} was not enqueued — it has already run for this slot, or the job " \ "class refused to enqueue.", level: :error end respond_with_toast recurring_frame, fallback: recurring_tasks_path end |