activejob 6.1.7.8 → 7.0.0.alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -247
- data/MIT-LICENSE +2 -1
- data/README.md +3 -3
- data/lib/active_job/arguments.rb +10 -15
- data/lib/active_job/base.rb +2 -2
- data/lib/active_job/configured_job.rb +5 -7
- data/lib/active_job/core.rb +11 -1
- data/lib/active_job/enqueuing.rb +22 -9
- data/lib/active_job/exceptions.rb +4 -2
- data/lib/active_job/execution.rb +12 -8
- data/lib/active_job/gem_version.rb +4 -4
- data/lib/active_job/instrumentation.rb +9 -5
- data/lib/active_job/log_subscriber.rb +1 -1
- data/lib/active_job/logging.rb +8 -5
- data/lib/active_job/query_tags.rb +16 -0
- data/lib/active_job/queue_adapter.rb +1 -1
- data/lib/active_job/queue_adapters/async_adapter.rb +6 -6
- data/lib/active_job/queue_adapters/backburner_adapter.rb +3 -3
- data/lib/active_job/queue_adapters/delayed_job_adapter.rb +14 -4
- data/lib/active_job/queue_adapters/inline_adapter.rb +2 -2
- data/lib/active_job/queue_adapters/que_adapter.rb +3 -3
- data/lib/active_job/queue_adapters/queue_classic_adapter.rb +3 -3
- data/lib/active_job/queue_adapters/resque_adapter.rb +3 -3
- data/lib/active_job/queue_adapters/sidekiq_adapter.rb +3 -3
- data/lib/active_job/queue_adapters/sneakers_adapter.rb +3 -3
- data/lib/active_job/queue_adapters/sucker_punch_adapter.rb +3 -3
- data/lib/active_job/queue_adapters/test_adapter.rb +3 -2
- data/lib/active_job/queue_name.rb +1 -1
- data/lib/active_job/railtie.rb +26 -1
- data/lib/active_job/serializers/range_serializer.rb +23 -0
- data/lib/active_job/serializers.rb +3 -1
- data/lib/active_job/test_helper.rb +7 -7
- data/lib/active_job/timezones.rb +1 -1
- data/lib/active_job/translation.rb +1 -1
- data/lib/active_job.rb +2 -1
- metadata +16 -15
data/lib/active_job/logging.rb
CHANGED
@@ -4,22 +4,25 @@ require "active_support/tagged_logging"
|
|
4
4
|
require "active_support/logger"
|
5
5
|
|
6
6
|
module ActiveJob
|
7
|
-
module Logging
|
7
|
+
module Logging # :nodoc:
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
included do
|
11
11
|
cattr_accessor :logger, default: ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))
|
12
12
|
class_attribute :log_arguments, instance_accessor: false, default: true
|
13
13
|
|
14
|
-
around_enqueue { |_, block| tag_logger(&block) }
|
15
|
-
|
14
|
+
around_enqueue(prepend: true) { |_, block| tag_logger(&block) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def perform_now
|
18
|
+
tag_logger(self.class.name, self.job_id) { super }
|
16
19
|
end
|
17
20
|
|
18
21
|
private
|
19
|
-
def tag_logger(*tags)
|
22
|
+
def tag_logger(*tags, &block)
|
20
23
|
if logger.respond_to?(:tagged)
|
21
24
|
tags.unshift "ActiveJob" unless logger_tagged_by_active_job?
|
22
|
-
logger.tagged(*tags)
|
25
|
+
logger.tagged(*tags, &block)
|
23
26
|
else
|
24
27
|
yield
|
25
28
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveJob
|
4
|
+
module QueryTags # :nodoc:
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
around_perform :expose_job_to_query_logs
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def expose_job_to_query_logs(&block)
|
13
|
+
ActiveRecord::QueryLogs.set_context(job: self, &block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -5,7 +5,7 @@ require "active_support/core_ext/string/inflections"
|
|
5
5
|
module ActiveJob
|
6
6
|
# The <tt>ActiveJob::QueueAdapter</tt> module is used to load the
|
7
7
|
# correct adapter. The default queue adapter is the +:async+ queue.
|
8
|
-
module QueueAdapter
|
8
|
+
module QueueAdapter # :nodoc:
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
11
|
included do
|
@@ -36,23 +36,23 @@ module ActiveJob
|
|
36
36
|
@scheduler = Scheduler.new(**executor_options)
|
37
37
|
end
|
38
38
|
|
39
|
-
def enqueue(job)
|
39
|
+
def enqueue(job) # :nodoc:
|
40
40
|
@scheduler.enqueue JobWrapper.new(job), queue_name: job.queue_name
|
41
41
|
end
|
42
42
|
|
43
|
-
def enqueue_at(job, timestamp)
|
43
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
44
44
|
@scheduler.enqueue_at JobWrapper.new(job), timestamp, queue_name: job.queue_name
|
45
45
|
end
|
46
46
|
|
47
47
|
# Gracefully stop processing jobs. Finishes in-progress work and handles
|
48
48
|
# any new jobs following the executor's fallback policy (`caller_runs`).
|
49
49
|
# Waits for termination by default. Pass `wait: false` to continue.
|
50
|
-
def shutdown(wait: true)
|
50
|
+
def shutdown(wait: true) # :nodoc:
|
51
51
|
@scheduler.shutdown wait: wait
|
52
52
|
end
|
53
53
|
|
54
54
|
# Used for our test suite.
|
55
|
-
def immediate=(immediate)
|
55
|
+
def immediate=(immediate) # :nodoc:
|
56
56
|
@scheduler.immediate = immediate
|
57
57
|
end
|
58
58
|
|
@@ -60,7 +60,7 @@ module ActiveJob
|
|
60
60
|
# performing them in-process, but we do so anyway for parity with other
|
61
61
|
# adapters and deployment environments. Otherwise, serialization bugs
|
62
62
|
# may creep in undetected.
|
63
|
-
class JobWrapper
|
63
|
+
class JobWrapper # :nodoc:
|
64
64
|
def initialize(job)
|
65
65
|
job.provider_job_id = SecureRandom.uuid
|
66
66
|
@job_data = job.serialize
|
@@ -71,7 +71,7 @@ module ActiveJob
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
class Scheduler
|
74
|
+
class Scheduler # :nodoc:
|
75
75
|
DEFAULT_EXECUTOR_OPTIONS = {
|
76
76
|
min_threads: 0,
|
77
77
|
max_threads: Concurrent.processor_count,
|
@@ -15,16 +15,16 @@ module ActiveJob
|
|
15
15
|
#
|
16
16
|
# Rails.application.config.active_job.queue_adapter = :backburner
|
17
17
|
class BackburnerAdapter
|
18
|
-
def enqueue(job)
|
18
|
+
def enqueue(job) # :nodoc:
|
19
19
|
Backburner::Worker.enqueue(JobWrapper, [job.serialize], queue: job.queue_name, pri: job.priority)
|
20
20
|
end
|
21
21
|
|
22
|
-
def enqueue_at(job, timestamp)
|
22
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
23
23
|
delay = timestamp - Time.current.to_f
|
24
24
|
Backburner::Worker.enqueue(JobWrapper, [job.serialize], queue: job.queue_name, pri: job.priority, delay: delay)
|
25
25
|
end
|
26
26
|
|
27
|
-
class JobWrapper
|
27
|
+
class JobWrapper # :nodoc:
|
28
28
|
class << self
|
29
29
|
def perform(job_data)
|
30
30
|
Base.execute job_data
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "delayed_job"
|
4
|
+
require "active_support/core_ext/string/inflections"
|
4
5
|
|
5
6
|
module ActiveJob
|
6
7
|
module QueueAdapters
|
@@ -15,19 +16,19 @@ module ActiveJob
|
|
15
16
|
#
|
16
17
|
# Rails.application.config.active_job.queue_adapter = :delayed_job
|
17
18
|
class DelayedJobAdapter
|
18
|
-
def enqueue(job)
|
19
|
+
def enqueue(job) # :nodoc:
|
19
20
|
delayed_job = Delayed::Job.enqueue(JobWrapper.new(job.serialize), queue: job.queue_name, priority: job.priority)
|
20
21
|
job.provider_job_id = delayed_job.id
|
21
22
|
delayed_job
|
22
23
|
end
|
23
24
|
|
24
|
-
def enqueue_at(job, timestamp)
|
25
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
25
26
|
delayed_job = Delayed::Job.enqueue(JobWrapper.new(job.serialize), queue: job.queue_name, priority: job.priority, run_at: Time.at(timestamp))
|
26
27
|
job.provider_job_id = delayed_job.id
|
27
28
|
delayed_job
|
28
29
|
end
|
29
30
|
|
30
|
-
class JobWrapper
|
31
|
+
class JobWrapper # :nodoc:
|
31
32
|
attr_accessor :job_data
|
32
33
|
|
33
34
|
def initialize(job_data)
|
@@ -35,12 +36,21 @@ module ActiveJob
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def display_name
|
38
|
-
"#{job_data[
|
39
|
+
base_name = "#{job_data["job_class"]} [#{job_data["job_id"]}] from DelayedJob(#{job_data["queue_name"]})"
|
40
|
+
|
41
|
+
return base_name unless log_arguments?
|
42
|
+
|
43
|
+
"#{base_name} with arguments: #{job_data["arguments"]}"
|
39
44
|
end
|
40
45
|
|
41
46
|
def perform
|
42
47
|
Base.execute(job_data)
|
43
48
|
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def log_arguments?
|
52
|
+
job_data["job_class"].constantize.log_arguments?
|
53
|
+
end
|
44
54
|
end
|
45
55
|
end
|
46
56
|
end
|
@@ -11,11 +11,11 @@ module ActiveJob
|
|
11
11
|
#
|
12
12
|
# Rails.application.config.active_job.queue_adapter = :inline
|
13
13
|
class InlineAdapter
|
14
|
-
def enqueue(job)
|
14
|
+
def enqueue(job) # :nodoc:
|
15
15
|
Base.execute(job.serialize)
|
16
16
|
end
|
17
17
|
|
18
|
-
def enqueue_at(*)
|
18
|
+
def enqueue_at(*) # :nodoc:
|
19
19
|
raise NotImplementedError, "Use a queueing backend to enqueue jobs in the future. Read more at https://guides.rubyonrails.org/active_job_basics.html"
|
20
20
|
end
|
21
21
|
end
|
@@ -17,19 +17,19 @@ module ActiveJob
|
|
17
17
|
#
|
18
18
|
# Rails.application.config.active_job.queue_adapter = :que
|
19
19
|
class QueAdapter
|
20
|
-
def enqueue(job)
|
20
|
+
def enqueue(job) # :nodoc:
|
21
21
|
que_job = JobWrapper.enqueue job.serialize, priority: job.priority, queue: job.queue_name
|
22
22
|
job.provider_job_id = que_job.attrs["job_id"]
|
23
23
|
que_job
|
24
24
|
end
|
25
25
|
|
26
|
-
def enqueue_at(job, timestamp)
|
26
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
27
27
|
que_job = JobWrapper.enqueue job.serialize, priority: job.priority, queue: job.queue_name, run_at: Time.at(timestamp)
|
28
28
|
job.provider_job_id = que_job.attrs["job_id"]
|
29
29
|
que_job
|
30
30
|
end
|
31
31
|
|
32
|
-
class JobWrapper < Que::Job
|
32
|
+
class JobWrapper < Que::Job # :nodoc:
|
33
33
|
def run(job_data)
|
34
34
|
Base.execute job_data
|
35
35
|
end
|
@@ -19,13 +19,13 @@ module ActiveJob
|
|
19
19
|
#
|
20
20
|
# Rails.application.config.active_job.queue_adapter = :queue_classic
|
21
21
|
class QueueClassicAdapter
|
22
|
-
def enqueue(job)
|
22
|
+
def enqueue(job) # :nodoc:
|
23
23
|
qc_job = build_queue(job.queue_name).enqueue("#{JobWrapper.name}.perform", job.serialize)
|
24
24
|
job.provider_job_id = qc_job["id"] if qc_job.is_a?(Hash)
|
25
25
|
qc_job
|
26
26
|
end
|
27
27
|
|
28
|
-
def enqueue_at(job, timestamp)
|
28
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
29
29
|
queue = build_queue(job.queue_name)
|
30
30
|
unless queue.respond_to?(:enqueue_at)
|
31
31
|
raise NotImplementedError, "To be able to schedule jobs with queue_classic " \
|
@@ -46,7 +46,7 @@ module ActiveJob
|
|
46
46
|
QC::Queue.new(queue_name)
|
47
47
|
end
|
48
48
|
|
49
|
-
class JobWrapper
|
49
|
+
class JobWrapper # :nodoc:
|
50
50
|
class << self
|
51
51
|
def perform(job_data)
|
52
52
|
Base.execute job_data
|
@@ -28,12 +28,12 @@ module ActiveJob
|
|
28
28
|
#
|
29
29
|
# Rails.application.config.active_job.queue_adapter = :resque
|
30
30
|
class ResqueAdapter
|
31
|
-
def enqueue(job)
|
31
|
+
def enqueue(job) # :nodoc:
|
32
32
|
JobWrapper.instance_variable_set(:@queue, job.queue_name)
|
33
33
|
Resque.enqueue_to job.queue_name, JobWrapper, job.serialize
|
34
34
|
end
|
35
35
|
|
36
|
-
def enqueue_at(job, timestamp)
|
36
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
37
37
|
unless Resque.respond_to?(:enqueue_at_with_queue)
|
38
38
|
raise NotImplementedError, "To be able to schedule jobs with Resque you need the " \
|
39
39
|
"resque-scheduler gem. Please add it to your Gemfile and run bundle install"
|
@@ -41,7 +41,7 @@ module ActiveJob
|
|
41
41
|
Resque.enqueue_at_with_queue job.queue_name, timestamp, JobWrapper, job.serialize
|
42
42
|
end
|
43
43
|
|
44
|
-
class JobWrapper
|
44
|
+
class JobWrapper # :nodoc:
|
45
45
|
class << self
|
46
46
|
def perform(job_data)
|
47
47
|
Base.execute job_data
|
@@ -17,7 +17,7 @@ module ActiveJob
|
|
17
17
|
#
|
18
18
|
# Rails.application.config.active_job.queue_adapter = :sidekiq
|
19
19
|
class SidekiqAdapter
|
20
|
-
def enqueue(job)
|
20
|
+
def enqueue(job) # :nodoc:
|
21
21
|
# Sidekiq::Client does not support symbols as keys
|
22
22
|
job.provider_job_id = Sidekiq::Client.push \
|
23
23
|
"class" => JobWrapper,
|
@@ -26,7 +26,7 @@ module ActiveJob
|
|
26
26
|
"args" => [ job.serialize ]
|
27
27
|
end
|
28
28
|
|
29
|
-
def enqueue_at(job, timestamp)
|
29
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
30
30
|
job.provider_job_id = Sidekiq::Client.push \
|
31
31
|
"class" => JobWrapper,
|
32
32
|
"wrapped" => job.class,
|
@@ -35,7 +35,7 @@ module ActiveJob
|
|
35
35
|
"at" => timestamp
|
36
36
|
end
|
37
37
|
|
38
|
-
class JobWrapper
|
38
|
+
class JobWrapper # :nodoc:
|
39
39
|
include Sidekiq::Worker
|
40
40
|
|
41
41
|
def perform(job_data)
|
@@ -22,18 +22,18 @@ module ActiveJob
|
|
22
22
|
@monitor = Monitor.new
|
23
23
|
end
|
24
24
|
|
25
|
-
def enqueue(job)
|
25
|
+
def enqueue(job) # :nodoc:
|
26
26
|
@monitor.synchronize do
|
27
27
|
JobWrapper.from_queue job.queue_name
|
28
28
|
JobWrapper.enqueue ActiveSupport::JSON.encode(job.serialize)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def enqueue_at(job, timestamp)
|
32
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
33
33
|
raise NotImplementedError, "This queueing backend does not support scheduling jobs. To see what features are supported go to http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html"
|
34
34
|
end
|
35
35
|
|
36
|
-
class JobWrapper
|
36
|
+
class JobWrapper # :nodoc:
|
37
37
|
include Sneakers::Worker
|
38
38
|
from_queue "default"
|
39
39
|
|
@@ -18,7 +18,7 @@ module ActiveJob
|
|
18
18
|
#
|
19
19
|
# Rails.application.config.active_job.queue_adapter = :sucker_punch
|
20
20
|
class SuckerPunchAdapter
|
21
|
-
def enqueue(job)
|
21
|
+
def enqueue(job) # :nodoc:
|
22
22
|
if JobWrapper.respond_to?(:perform_async)
|
23
23
|
# sucker_punch 2.0 API
|
24
24
|
JobWrapper.perform_async job.serialize
|
@@ -28,7 +28,7 @@ module ActiveJob
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def enqueue_at(job, timestamp)
|
31
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
32
32
|
if JobWrapper.respond_to?(:perform_in)
|
33
33
|
delay = timestamp - Time.current.to_f
|
34
34
|
JobWrapper.perform_in delay, job.serialize
|
@@ -37,7 +37,7 @@ module ActiveJob
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
class JobWrapper
|
40
|
+
class JobWrapper # :nodoc:
|
41
41
|
include SuckerPunch::Job
|
42
42
|
|
43
43
|
def perform(job_data)
|
@@ -25,12 +25,12 @@ module ActiveJob
|
|
25
25
|
@performed_jobs ||= []
|
26
26
|
end
|
27
27
|
|
28
|
-
def enqueue(job)
|
28
|
+
def enqueue(job) # :nodoc:
|
29
29
|
job_data = job_to_hash(job)
|
30
30
|
perform_or_enqueue(perform_enqueued_jobs && !filtered?(job), job, job_data)
|
31
31
|
end
|
32
32
|
|
33
|
-
def enqueue_at(job, timestamp)
|
33
|
+
def enqueue_at(job, timestamp) # :nodoc:
|
34
34
|
job_data = job_to_hash(job, at: timestamp)
|
35
35
|
perform_or_enqueue(perform_enqueued_at_jobs && !filtered?(job), job, job_data)
|
36
36
|
end
|
@@ -41,6 +41,7 @@ module ActiveJob
|
|
41
41
|
job_data[:job] = job.class
|
42
42
|
job_data[:args] = job_data.fetch("arguments")
|
43
43
|
job_data[:queue] = job_data.fetch("queue_name")
|
44
|
+
job_data[:priority] = job_data.fetch("priority")
|
44
45
|
end.merge(extras)
|
45
46
|
end
|
46
47
|
|
@@ -45,7 +45,7 @@ module ActiveJob
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
def queue_name_from_part(part_name)
|
48
|
+
def queue_name_from_part(part_name) # :nodoc:
|
49
49
|
queue_name = part_name || default_queue_name
|
50
50
|
name_parts = [queue_name_prefix.presence, queue_name]
|
51
51
|
-name_parts.compact.join(queue_name_delimiter)
|
data/lib/active_job/railtie.rb
CHANGED
@@ -8,6 +8,7 @@ module ActiveJob
|
|
8
8
|
class Railtie < Rails::Railtie # :nodoc:
|
9
9
|
config.active_job = ActiveSupport::OrderedOptions.new
|
10
10
|
config.active_job.custom_serializers = []
|
11
|
+
config.active_job.log_query_tags_around_perform = true
|
11
12
|
|
12
13
|
initializer "active_job.logger" do
|
13
14
|
ActiveSupport.on_load(:active_job) { self.logger = ::Rails.logger }
|
@@ -15,7 +16,7 @@ module ActiveJob
|
|
15
16
|
|
16
17
|
initializer "active_job.custom_serializers" do |app|
|
17
18
|
config.after_initialize do
|
18
|
-
custom_serializers = app.config.active_job.
|
19
|
+
custom_serializers = app.config.active_job.custom_serializers
|
19
20
|
ActiveJob::Serializers.add_serializers custom_serializers
|
20
21
|
end
|
21
22
|
end
|
@@ -25,6 +26,12 @@ module ActiveJob
|
|
25
26
|
options.queue_adapter ||= :async
|
26
27
|
|
27
28
|
ActiveSupport.on_load(:active_job) do
|
29
|
+
# Configs used in other initializers
|
30
|
+
options = options.except(
|
31
|
+
:log_query_tags_around_perform,
|
32
|
+
:custom_serializers
|
33
|
+
)
|
34
|
+
|
28
35
|
options.each do |k, v|
|
29
36
|
k = "#{k}="
|
30
37
|
send(k, v) if respond_to? k
|
@@ -49,5 +56,23 @@ module ActiveJob
|
|
49
56
|
end
|
50
57
|
end
|
51
58
|
end
|
59
|
+
|
60
|
+
initializer "active_job.query_log_tags" do |app|
|
61
|
+
query_logs_tags_enabled = app.config.respond_to?(:active_record) &&
|
62
|
+
app.config.active_record.query_log_tags_enabled &&
|
63
|
+
app.config.active_job.log_query_tags_around_perform
|
64
|
+
|
65
|
+
if query_logs_tags_enabled
|
66
|
+
app.config.active_record.query_log_tags << :job
|
67
|
+
|
68
|
+
ActiveSupport.on_load(:active_job) do
|
69
|
+
include ActiveJob::QueryTags
|
70
|
+
end
|
71
|
+
|
72
|
+
ActiveSupport.on_load(:active_record) do
|
73
|
+
ActiveRecord::QueryLogs.taggings[:job] = ->(context) { context[:job].class.name unless context[:job].nil? }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
52
77
|
end
|
53
78
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveJob
|
4
|
+
module Serializers
|
5
|
+
class RangeSerializer < ObjectSerializer
|
6
|
+
KEYS = %w[begin end exclude_end].freeze
|
7
|
+
|
8
|
+
def serialize(range)
|
9
|
+
args = Arguments.serialize([range.begin, range.end, range.exclude_end?])
|
10
|
+
super(KEYS.zip(args).to_h)
|
11
|
+
end
|
12
|
+
|
13
|
+
def deserialize(hash)
|
14
|
+
klass.new(*Arguments.deserialize(hash.values_at(*KEYS)))
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def klass
|
19
|
+
::Range
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -17,6 +17,7 @@ module ActiveJob
|
|
17
17
|
autoload :TimeWithZoneSerializer
|
18
18
|
autoload :TimeSerializer
|
19
19
|
autoload :ModuleSerializer
|
20
|
+
autoload :RangeSerializer
|
20
21
|
|
21
22
|
mattr_accessor :_additional_serializers
|
22
23
|
self._additional_serializers = Set.new
|
@@ -61,6 +62,7 @@ module ActiveJob
|
|
61
62
|
DateSerializer,
|
62
63
|
TimeWithZoneSerializer,
|
63
64
|
TimeSerializer,
|
64
|
-
ModuleSerializer
|
65
|
+
ModuleSerializer,
|
66
|
+
RangeSerializer
|
65
67
|
end
|
66
68
|
end
|
@@ -124,7 +124,7 @@ module ActiveJob
|
|
124
124
|
if block_given?
|
125
125
|
original_jobs = enqueued_jobs_with(only: only, except: except, queue: queue)
|
126
126
|
|
127
|
-
|
127
|
+
_assert_nothing_raised_or_warn("assert_enqueued_jobs", &block)
|
128
128
|
|
129
129
|
new_jobs = enqueued_jobs_with(only: only, except: except, queue: queue)
|
130
130
|
|
@@ -389,15 +389,15 @@ module ActiveJob
|
|
389
389
|
# MyJob.set(wait_until: Date.tomorrow.noon).perform_later
|
390
390
|
# end
|
391
391
|
# end
|
392
|
-
def assert_enqueued_with(job: nil, args: nil, at: nil, queue: nil, &block)
|
393
|
-
expected = { job: job, args: args, at: at, queue: queue }.compact
|
392
|
+
def assert_enqueued_with(job: nil, args: nil, at: nil, queue: nil, priority: nil, &block)
|
393
|
+
expected = { job: job, args: args, at: at, queue: queue, priority: priority }.compact
|
394
394
|
expected_args = prepare_args_for_assertion(expected)
|
395
395
|
potential_matches = []
|
396
396
|
|
397
397
|
if block_given?
|
398
398
|
original_enqueued_jobs = enqueued_jobs.dup
|
399
399
|
|
400
|
-
|
400
|
+
_assert_nothing_raised_or_warn("assert_enqueued_with", &block)
|
401
401
|
|
402
402
|
jobs = enqueued_jobs - original_enqueued_jobs
|
403
403
|
else
|
@@ -479,8 +479,8 @@ module ActiveJob
|
|
479
479
|
# MyJob.set(wait_until: Date.tomorrow.noon).perform_later
|
480
480
|
# end
|
481
481
|
# end
|
482
|
-
def assert_performed_with(job: nil, args: nil, at: nil, queue: nil, &block)
|
483
|
-
expected = { job: job, args: args, at: at, queue: queue }.compact
|
482
|
+
def assert_performed_with(job: nil, args: nil, at: nil, queue: nil, priority: nil, &block)
|
483
|
+
expected = { job: job, args: args, at: at, queue: queue, priority: priority }.compact
|
484
484
|
expected_args = prepare_args_for_assertion(expected)
|
485
485
|
potential_matches = []
|
486
486
|
|
@@ -591,7 +591,7 @@ module ActiveJob
|
|
591
591
|
queue_adapter.queue = queue
|
592
592
|
queue_adapter.at = at
|
593
593
|
|
594
|
-
|
594
|
+
_assert_nothing_raised_or_warn("perform_enqueued_jobs", &block)
|
595
595
|
ensure
|
596
596
|
queue_adapter.perform_enqueued_jobs = old_perform_enqueued_jobs
|
597
597
|
queue_adapter.perform_enqueued_at_jobs = old_perform_enqueued_at_jobs
|
data/lib/active_job/timezones.rb
CHANGED
data/lib/active_job.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright (c) 2014-
|
4
|
+
# Copyright (c) 2014-2021 David Heinemeier Hansson
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining
|
7
7
|
# a copy of this software and associated documentation files (the
|
@@ -37,4 +37,5 @@ module ActiveJob
|
|
37
37
|
autoload :ConfiguredJob
|
38
38
|
autoload :TestCase
|
39
39
|
autoload :TestHelper
|
40
|
+
autoload :QueryTags
|
40
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activejob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0.alpha1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.0.0.alpha1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.0.0.alpha1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: globalid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/active_job/instrumentation.rb
|
61
61
|
- lib/active_job/log_subscriber.rb
|
62
62
|
- lib/active_job/logging.rb
|
63
|
+
- lib/active_job/query_tags.rb
|
63
64
|
- lib/active_job/queue_adapter.rb
|
64
65
|
- lib/active_job/queue_adapters.rb
|
65
66
|
- lib/active_job/queue_adapters/async_adapter.rb
|
@@ -82,6 +83,7 @@ files:
|
|
82
83
|
- lib/active_job/serializers/duration_serializer.rb
|
83
84
|
- lib/active_job/serializers/module_serializer.rb
|
84
85
|
- lib/active_job/serializers/object_serializer.rb
|
86
|
+
- lib/active_job/serializers/range_serializer.rb
|
85
87
|
- lib/active_job/serializers/symbol_serializer.rb
|
86
88
|
- lib/active_job/serializers/time_object_serializer.rb
|
87
89
|
- lib/active_job/serializers/time_serializer.rb
|
@@ -99,12 +101,11 @@ licenses:
|
|
99
101
|
- MIT
|
100
102
|
metadata:
|
101
103
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
102
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
103
|
-
documentation_uri: https://api.rubyonrails.org/
|
104
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.0.alpha1/activejob/CHANGELOG.md
|
105
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.0.alpha1/
|
104
106
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
105
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
106
|
-
|
107
|
-
post_install_message:
|
107
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.0.alpha1/activejob
|
108
|
+
post_install_message:
|
108
109
|
rdoc_options: []
|
109
110
|
require_paths:
|
110
111
|
- lib
|
@@ -112,15 +113,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
113
|
requirements:
|
113
114
|
- - ">="
|
114
115
|
- !ruby/object:Gem::Version
|
115
|
-
version: 2.
|
116
|
+
version: 2.7.0
|
116
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
118
|
requirements:
|
118
|
-
- - "
|
119
|
+
- - ">"
|
119
120
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
121
|
+
version: 1.3.1
|
121
122
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
123
|
-
signing_key:
|
123
|
+
rubygems_version: 3.1.6
|
124
|
+
signing_key:
|
124
125
|
specification_version: 4
|
125
126
|
summary: Job framework with pluggable queues.
|
126
127
|
test_files: []
|