Class: ActiveJob::QueueAdapters::SolidQueueExt::SolidQueueJobs

Inherits:
Object
  • Object
show all
Defined in:
lib/active_job/queue_adapters/solid_queue_ext.rb

Constant Summary collapse

STATUS_MAP =
{
  pending: :ready,
  failed: :failed,
  in_progress: :claimed,
  blocked: :blocked,
  scheduled: :scheduled,
  finished: :finished
}

Instance Method Summary collapse

Constructor Details

#initialize(jobs_relation) ⇒ SolidQueueJobs

Returns a new instance of SolidQueueJobs.



146
147
148
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 146

def initialize(jobs_relation)
  @jobs_relation = jobs_relation
end

Instance Method Details

#countObject



154
155
156
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 154

def count
  limit_value_provided? ? direct_count : internally_limited_count
end

#discard_allObject



164
165
166
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 164

def discard_all
  execution_class_by_status.discard_all_from_jobs(jobs)
end

#find_job(active_job_id) ⇒ Object



158
159
160
161
162
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 158

def find_job(active_job_id)
  if job = SolidQueue::Job.where(active_job_id: active_job_id).order(:id).last
    job if matches_relation_filters?(job)
  end
end

#jobsObject



150
151
152
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 150

def jobs
  solid_queue_status.finished? ? order_finished_jobs(finished_jobs) : order_executions(executions).map(&:job).compact
end

#retry_allObject



168
169
170
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 168

def retry_all
  SolidQueue::FailedExecution.retry_all(jobs)
end