sidekiq 6.5.1 → 7.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes.md +376 -12
- data/README.md +43 -35
- data/bin/multi_queue_bench +271 -0
- data/bin/sidekiq +3 -8
- data/bin/sidekiqload +213 -118
- data/bin/sidekiqmon +3 -0
- data/lib/active_job/queue_adapters/sidekiq_adapter.rb +88 -0
- data/lib/generators/sidekiq/job_generator.rb +2 -0
- data/lib/sidekiq/api.rb +378 -173
- data/lib/sidekiq/capsule.rb +132 -0
- data/lib/sidekiq/cli.rb +61 -63
- data/lib/sidekiq/client.rb +89 -40
- data/lib/sidekiq/component.rb +6 -2
- data/lib/sidekiq/config.rb +305 -0
- data/lib/sidekiq/deploy.rb +64 -0
- data/lib/sidekiq/embedded.rb +63 -0
- data/lib/sidekiq/fetch.rb +11 -14
- data/lib/sidekiq/iterable_job.rb +55 -0
- data/lib/sidekiq/job/interrupt_handler.rb +24 -0
- data/lib/sidekiq/job/iterable/active_record_enumerator.rb +53 -0
- data/lib/sidekiq/job/iterable/csv_enumerator.rb +47 -0
- data/lib/sidekiq/job/iterable/enumerators.rb +135 -0
- data/lib/sidekiq/job/iterable.rb +294 -0
- data/lib/sidekiq/job.rb +382 -10
- data/lib/sidekiq/job_logger.rb +8 -7
- data/lib/sidekiq/job_retry.rb +89 -46
- data/lib/sidekiq/job_util.rb +53 -15
- data/lib/sidekiq/launcher.rb +77 -69
- data/lib/sidekiq/logger.rb +2 -27
- data/lib/sidekiq/manager.rb +9 -11
- data/lib/sidekiq/metrics/query.rb +158 -0
- data/lib/sidekiq/metrics/shared.rb +106 -0
- data/lib/sidekiq/metrics/tracking.rb +148 -0
- data/lib/sidekiq/middleware/chain.rb +84 -48
- data/lib/sidekiq/middleware/current_attributes.rb +87 -20
- data/lib/sidekiq/middleware/modules.rb +2 -0
- data/lib/sidekiq/monitor.rb +19 -5
- data/lib/sidekiq/paginator.rb +11 -3
- data/lib/sidekiq/processor.rb +67 -56
- data/lib/sidekiq/rails.rb +22 -16
- data/lib/sidekiq/redis_client_adapter.rb +31 -71
- data/lib/sidekiq/redis_connection.rb +44 -117
- data/lib/sidekiq/ring_buffer.rb +2 -0
- data/lib/sidekiq/scheduled.rb +62 -35
- data/lib/sidekiq/systemd.rb +2 -0
- data/lib/sidekiq/testing.rb +37 -46
- data/lib/sidekiq/transaction_aware_client.rb +11 -5
- data/lib/sidekiq/version.rb +6 -1
- data/lib/sidekiq/web/action.rb +15 -5
- data/lib/sidekiq/web/application.rb +94 -24
- data/lib/sidekiq/web/csrf_protection.rb +10 -7
- data/lib/sidekiq/web/helpers.rb +118 -45
- data/lib/sidekiq/web/router.rb +5 -2
- data/lib/sidekiq/web.rb +67 -15
- data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
- data/lib/sidekiq.rb +78 -266
- data/sidekiq.gemspec +12 -10
- data/web/assets/javascripts/application.js +46 -1
- data/web/assets/javascripts/base-charts.js +106 -0
- data/web/assets/javascripts/chart.min.js +13 -0
- data/web/assets/javascripts/chartjs-plugin-annotation.min.js +7 -0
- data/web/assets/javascripts/dashboard-charts.js +192 -0
- data/web/assets/javascripts/dashboard.js +11 -250
- data/web/assets/javascripts/metrics.js +298 -0
- data/web/assets/stylesheets/application-dark.css +4 -0
- data/web/assets/stylesheets/application-rtl.css +10 -89
- data/web/assets/stylesheets/application.css +98 -295
- data/web/locales/ar.yml +70 -70
- data/web/locales/cs.yml +62 -62
- data/web/locales/da.yml +60 -53
- data/web/locales/de.yml +65 -65
- data/web/locales/el.yml +43 -24
- data/web/locales/en.yml +83 -69
- data/web/locales/es.yml +68 -68
- data/web/locales/fa.yml +65 -65
- data/web/locales/fr.yml +80 -67
- data/web/locales/gd.yml +98 -0
- data/web/locales/he.yml +65 -64
- data/web/locales/hi.yml +59 -59
- data/web/locales/it.yml +85 -54
- data/web/locales/ja.yml +72 -68
- data/web/locales/ko.yml +52 -52
- data/web/locales/lt.yml +66 -66
- data/web/locales/nb.yml +61 -61
- data/web/locales/nl.yml +52 -52
- data/web/locales/pl.yml +45 -45
- data/web/locales/pt-br.yml +78 -69
- data/web/locales/pt.yml +51 -51
- data/web/locales/ru.yml +67 -66
- data/web/locales/sv.yml +53 -53
- data/web/locales/ta.yml +60 -60
- data/web/locales/tr.yml +100 -0
- data/web/locales/uk.yml +85 -61
- data/web/locales/ur.yml +64 -64
- data/web/locales/vi.yml +67 -67
- data/web/locales/zh-cn.yml +42 -16
- data/web/locales/zh-tw.yml +41 -8
- data/web/views/_footer.erb +17 -2
- data/web/views/_job_info.erb +18 -2
- data/web/views/_metrics_period_select.erb +12 -0
- data/web/views/_nav.erb +1 -1
- data/web/views/_paging.erb +2 -0
- data/web/views/_poll_link.erb +1 -1
- data/web/views/_summary.erb +7 -7
- data/web/views/busy.erb +49 -33
- data/web/views/dashboard.erb +28 -6
- data/web/views/filtering.erb +6 -0
- data/web/views/layout.erb +6 -6
- data/web/views/metrics.erb +90 -0
- data/web/views/metrics_for_job.erb +59 -0
- data/web/views/morgue.erb +5 -9
- data/web/views/queue.erb +15 -15
- data/web/views/queues.erb +9 -3
- data/web/views/retries.erb +5 -9
- data/web/views/scheduled.erb +12 -13
- metadata +61 -26
- data/lib/sidekiq/.DS_Store +0 -0
- data/lib/sidekiq/delay.rb +0 -43
- data/lib/sidekiq/extensions/action_mailer.rb +0 -48
- data/lib/sidekiq/extensions/active_record.rb +0 -43
- data/lib/sidekiq/extensions/class_methods.rb +0 -43
- data/lib/sidekiq/extensions/generic_proxy.rb +0 -33
- data/lib/sidekiq/worker.rb +0 -367
- /data/{LICENSE → LICENSE.txt} +0 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sidekiq
|
4
|
+
module ActiveJob
|
5
|
+
# @api private
|
6
|
+
class Wrapper
|
7
|
+
include Sidekiq::Job
|
8
|
+
|
9
|
+
def perform(job_data)
|
10
|
+
::ActiveJob::Base.execute(job_data.merge("provider_job_id" => jid))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module ActiveJob
|
17
|
+
module QueueAdapters
|
18
|
+
# Explicitly remove the implementation existing in older rails'.
|
19
|
+
remove_const(:SidekiqAdapter) if const_defined?(:SidekiqAdapter)
|
20
|
+
|
21
|
+
# Sidekiq adapter for Active Job
|
22
|
+
#
|
23
|
+
# To use Sidekiq set the queue_adapter config to +:sidekiq+.
|
24
|
+
#
|
25
|
+
# Rails.application.config.active_job.queue_adapter = :sidekiq
|
26
|
+
class SidekiqAdapter
|
27
|
+
# Defines whether enqueuing should happen implicitly to after commit when called
|
28
|
+
# from inside a transaction.
|
29
|
+
# @api private
|
30
|
+
def enqueue_after_transaction_commit?
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
# @api private
|
35
|
+
def enqueue(job)
|
36
|
+
job.provider_job_id = JobWrapper.set(
|
37
|
+
wrapped: job.class,
|
38
|
+
queue: job.queue_name
|
39
|
+
).perform_async(job.serialize)
|
40
|
+
end
|
41
|
+
|
42
|
+
# @api private
|
43
|
+
def enqueue_at(job, timestamp)
|
44
|
+
job.provider_job_id = JobWrapper.set(
|
45
|
+
wrapped: job.class,
|
46
|
+
queue: job.queue_name
|
47
|
+
).perform_at(timestamp, job.serialize)
|
48
|
+
end
|
49
|
+
|
50
|
+
# @api private
|
51
|
+
def enqueue_all(jobs)
|
52
|
+
enqueued_count = 0
|
53
|
+
jobs.group_by(&:class).each do |job_class, same_class_jobs|
|
54
|
+
same_class_jobs.group_by(&:queue_name).each do |queue, same_class_and_queue_jobs|
|
55
|
+
immediate_jobs, scheduled_jobs = same_class_and_queue_jobs.partition { |job| job.scheduled_at.nil? }
|
56
|
+
|
57
|
+
if immediate_jobs.any?
|
58
|
+
jids = Sidekiq::Client.push_bulk(
|
59
|
+
"class" => JobWrapper,
|
60
|
+
"wrapped" => job_class,
|
61
|
+
"queue" => queue,
|
62
|
+
"args" => immediate_jobs.map { |job| [job.serialize] }
|
63
|
+
)
|
64
|
+
enqueued_count += jids.compact.size
|
65
|
+
end
|
66
|
+
|
67
|
+
if scheduled_jobs.any?
|
68
|
+
jids = Sidekiq::Client.push_bulk(
|
69
|
+
"class" => JobWrapper,
|
70
|
+
"wrapped" => job_class,
|
71
|
+
"queue" => queue,
|
72
|
+
"args" => scheduled_jobs.map { |job| [job.serialize] },
|
73
|
+
"at" => scheduled_jobs.map { |job| job.scheduled_at&.to_f }
|
74
|
+
)
|
75
|
+
enqueued_count += jids.compact.size
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
enqueued_count
|
80
|
+
end
|
81
|
+
|
82
|
+
# Defines a class alias for backwards compatibility with enqueued Active Job jobs.
|
83
|
+
# @api private
|
84
|
+
class JobWrapper < Sidekiq::ActiveJob::Wrapper
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|