Class: Cloudtasker::WorkerController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/cloudtasker/worker_controller.rb

Overview

Handle execution of workers

Instance Method Summary collapse

Instance Method Details

#runObject

POST /cloudtasker/run

Run a worker from a Cloud Task payload



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/cloudtasker/worker_controller.rb', line 21

def run
  # Process payload
  WorkerHandler.execute_from_payload!(payload)
  head :no_content
rescue DeadWorkerError
  # 205: job will NOT be retried
  head :reset_content
rescue InvalidWorkerError
  # 404: Job will be retried
  head :not_found
rescue StandardError
  # 422: Job will be retried
  head :unprocessable_entity
end