Module: ActiveJob::QueueAdapters::SolidQueueExt
Defined Under Namespace
Classes: SolidQueueJobs
Instance Method Summary
collapse
#can_enqueue_recurring_task?, #enqueue_recurring_task, #find_recurring_task, #recurring_tasks, #supports_recurring_tasks?
Methods included from Workers
#count_workers, #exposes_workers?, #fetch_workers, #find_worker
#activating, #exposes_workers?, #find_recurring_task, #find_worker, #recurring_tasks, #supports_job_filter?, #supports_job_status?, #supports_queue_pausing?, #supports_recurring_tasks?, #workers
Instance Method Details
#clear_queue(queue_name) ⇒ Object
22
23
24
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 22
def clear_queue(queue_name)
find_queue_by_name(queue_name).clear
end
|
#discard_all_jobs(jobs_relation) ⇒ Object
64
65
66
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 64
def discard_all_jobs(jobs_relation)
SolidQueueJobs.new(jobs_relation).discard_all
end
|
#discard_job(job, jobs_relation) ⇒ Object
68
69
70
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 68
def discard_job(job, jobs_relation)
find_solid_queue_job!(job.job_id, jobs_relation).discard
end
|
#dispatch_job(job, jobs_relation) ⇒ Object
72
73
74
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 72
def dispatch_job(job, jobs_relation)
dispatch_immediately find_solid_queue_job!(job.job_id, jobs_relation)
end
|
#fetch_jobs(jobs_relation) ⇒ Object
50
51
52
53
54
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 50
def fetch_jobs(jobs_relation)
SolidQueueJobs.new(jobs_relation).jobs.map do |job|
deserialize_and_proxy_solid_queue_job(job, jobs_relation.status)
end
end
|
#find_job(job_id) ⇒ Object
76
77
78
79
80
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 76
def find_job(job_id, *)
if job = SolidQueue::Job.where(active_job_id: job_id).order(:id).last
deserialize_and_proxy_solid_queue_job job
end
end
|
#jobs_count(jobs_relation) ⇒ Object
46
47
48
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 46
def jobs_count(jobs_relation)
SolidQueueJobs.new(jobs_relation).count
end
|
#pause_queue(queue_name) ⇒ Object
26
27
28
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 26
def pause_queue(queue_name)
find_queue_by_name(queue_name).pause
end
|
#queue_paused?(queue_name) ⇒ Boolean
34
35
36
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 34
def queue_paused?(queue_name)
find_queue_by_name(queue_name).paused?
end
|
#queue_size(queue_name) ⇒ Object
18
19
20
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 18
def queue_size(queue_name)
find_queue_by_name(queue_name).size
end
|
#queues ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 5
def queues
queues = SolidQueue::Queue.all
pauses = SolidQueue::Pause.where(queue_name: queues.map(&:name)).index_by(&:queue_name)
queues.collect do |queue|
{
name: queue.name,
size: queue.size,
active: pauses[queue.name].nil?
}
end
end
|
#resume_queue(queue_name) ⇒ Object
30
31
32
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 30
def resume_queue(queue_name)
find_queue_by_name(queue_name).resume
end
|
#retry_all_jobs(jobs_relation) ⇒ Object
56
57
58
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 56
def retry_all_jobs(jobs_relation)
SolidQueueJobs.new(jobs_relation).retry_all
end
|
#retry_job(job, jobs_relation) ⇒ Object
60
61
62
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 60
def retry_job(job, jobs_relation)
find_solid_queue_job!(job.job_id, jobs_relation).retry
end
|
#supported_job_filters ⇒ Object
42
43
44
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 42
def supported_job_filters(*)
[ :queue_name, :job_class_name, :finished_at ]
end
|
#supported_job_statuses ⇒ Object
38
39
40
|
# File 'lib/active_job/queue_adapters/solid_queue_ext.rb', line 38
def supported_job_statuses
SolidQueueJobs::STATUS_MAP.keys
end
|