Class: ActiveJob::QueueAdapters::CloudtaskerAdapter::JobWrapper

Inherits:
Object
  • Object
show all
Includes:
Cloudtasker::Worker
Defined in:
lib/active_job/queue_adapters/cloudtasker_adapter.rb

Overview

Job Wrapper for the Cloudtasker adapter

Executes jobs scheduled by the Cloudtasker ActiveJob adapter

Instance Method Summary collapse

Methods included from Cloudtasker::Worker

#==, #arguments_missing?, clear_all, #dispatch_deadline, drain_all, #execute, from_hash, from_json, included, #initialize, #job_class_name, #job_dead?, #job_duration, #job_max_retries, #job_must_die?, #job_queue, #logger, #new_instance, #reenqueue, #run_callback, #schedule, #schedule_time, #to_h, #to_json

Instance Method Details

#perform(job_serialization, *_extra_options) ⇒ any

Executes the given serialized ActiveJob call.

Parameters:

  • job_serialization (Hash)

    The serialized ActiveJob call

Returns:

  • (any)

    The execution of the ActiveJob call



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/active_job/queue_adapters/cloudtasker_adapter.rb', line 66

def perform(job_serialization, *_extra_options)
  job_executions = job_retries < 1 ? 0 : (job_retries + 1)

  job_serialization.merge!(
    'job_id' => job_id,
    'queue_name' => job_queue,
    'provider_job_id' => task_id,
    'executions' => job_executions,
    'priority' => nil
  )

  Base.execute job_serialization
end