Class: RailsCloudTasks::Rack::Tasks
- Inherits:
-
Object
- Object
- RailsCloudTasks::Rack::Tasks
- Defined in:
- lib/rails_cloud_tasks/rack/tasks.rb
Class Method Summary collapse
Class Method Details
.call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rails_cloud_tasks/rack/tasks.rb', line 8 def call(env) request = ::Rack::Request.new(env) job = extract_job(request) RailsCloudTasks::Instrumentation.transaction_name!( "RailsCloudTasks/#{job['job_class']}/perform_now" ) RailsCloudTasks::Instrumentation.add_custom_attributes( { request_body: job['arguments'] } ) ActiveJob::Base.execute(job) response(200, {}) rescue Rack::InvalidPayloadError => e response(400, { error: e.cause. }) end |