activejob 6.0.0.beta3 → 6.0.2.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a66495d4239cd228e57d495037feecd031a097ca550ebd605d52b8d708c803bf
4
- data.tar.gz: 745235d248315d2477a1428d5ad96ac93cd2dcd3ad2b7da4c42aa2ed1eb8fb55
3
+ metadata.gz: 55a6f083a5d4f5f98f8e29b57ca8e6d197411be95b9dfad8c4cc1fe0ffd2b14f
4
+ data.tar.gz: 17d951ccdfabc1e75c6c2a6d3e773e31c849317c1f9c43234f379951b908d2b0
5
5
  SHA512:
6
- metadata.gz: e25e0b8defb7e0fefa2d45c6abccb641acb870cf60c3bd5a1d52a97168513578fc2ab2fbc9f6d0f22dba333f2793207f1be3e2bc27e407ba3d77f7bc76478fb0
7
- data.tar.gz: 5eb6cdcdaf4bd4fffcff477546730aa64c8fb2ef6e8dd3fea346141c018c8c23e0c7ac4bc11a8de5300e2c1b4e0ad84f46ceb31c463ddc12bc40e792efb24d49
6
+ metadata.gz: 4111e2163948e083c95ceb978e4049272aee18577d0b3e5194da8f585a7bce46ad4e678de9d06b2e8b4f3cd60e6f5d1ef9af56487d606ec376fc0a4ea3b7d085
7
+ data.tar.gz: 800baf3d76a90429e8730a4842521ed7683e818fe4f1eed6e56465f8fa813cc0431a590b966aac7740c4e710b023272ce57b24a08493cab8619a0babfe84acae
@@ -1,3 +1,43 @@
1
+ ## Rails 6.0.2.rc2 (December 09, 2019) ##
2
+
3
+ * Allow Sidekiq access to the underlying job class.
4
+
5
+ By having access to the Active Job class, Sidekiq can get access to any `sidekiq_options` which
6
+ have been set on that Active Job type and serialize those options into Redis.
7
+
8
+ https://github.com/mperham/sidekiq/blob/master/Changes.md#60
9
+
10
+ *Mike Perham*
11
+
12
+
13
+ ## Rails 6.0.1 (November 5, 2019) ##
14
+
15
+ * No changes.
16
+
17
+
18
+ ## Rails 6.0.0 (August 16, 2019) ##
19
+
20
+ * `assert_enqueued_with` and `assert_performed_with` can now test jobs with relative delay.
21
+
22
+ *Vlado Cingel*
23
+
24
+
25
+ ## Rails 6.0.0.rc2 (July 22, 2019) ##
26
+
27
+ * No changes.
28
+
29
+
30
+ ## Rails 6.0.0.rc1 (April 24, 2019) ##
31
+
32
+ * Use individual execution counters when calculating retry delay.
33
+
34
+ *Patrik Bóna*
35
+
36
+ * Make job argument assertions with `Time`, `ActiveSupport::TimeWithZone`, and `DateTime` work by dropping microseconds. Microsecond precision is lost during serialization.
37
+
38
+ *Gannon McGibbon*
39
+
40
+
1
41
  ## Rails 6.0.0.beta3 (March 11, 2019) ##
2
42
 
3
43
  * No changes.
@@ -29,7 +69,7 @@
29
69
 
30
70
  *Edouard Chin*
31
71
 
32
- * Restore HashWithIndifferentAccess support to ActiveJob::Arguments.deserialize.
72
+ * Restore `HashWithIndifferentAccess` support to `ActiveJob::Arguments.deserialize`.
33
73
 
34
74
  *Gannon McGibbon*
35
75
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Active Job -- Make work happen later
1
+ # Active Job Make work happen later
2
2
 
3
3
  Active Job is a framework for declaring jobs and making them run on a variety
4
4
  of queuing backends. These jobs can be everything from regularly scheduled
@@ -17,12 +17,13 @@ about API differences between Delayed Job and Resque. Picking your queuing
17
17
  backend becomes more of an operational concern, then. And you'll be able to
18
18
  switch between them without having to rewrite your jobs.
19
19
 
20
+ You can read more about Active Job in the [Active Job Basics](https://edgeguides.rubyonrails.org/active_job_basics.html) guide.
20
21
 
21
22
  ## Usage
22
23
 
23
24
  To learn how to use your preferred queuing backend see its adapter
24
25
  documentation at
25
- [ActiveJob::QueueAdapters](http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html).
26
+ [ActiveJob::QueueAdapters](https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html).
26
27
 
27
28
  Declare a job like so:
28
29
 
@@ -86,7 +87,7 @@ by default has been mixed into Active Record classes.
86
87
 
87
88
  Active Job has built-in adapters for multiple queuing backends (Sidekiq,
88
89
  Resque, Delayed Job and others). To get an up-to-date list of the adapters
89
- see the API Documentation for [ActiveJob::QueueAdapters](http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html).
90
+ see the API Documentation for [ActiveJob::QueueAdapters](https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html).
90
91
 
91
92
  **Please note:** We are not accepting pull requests for new adapters. We
92
93
  encourage library authors to provide an ActiveJob adapter as part of
@@ -121,7 +122,7 @@ Active Job is released under the MIT license:
121
122
 
122
123
  API documentation is at:
123
124
 
124
- * http://api.rubyonrails.org
125
+ * https://api.rubyonrails.org
125
126
 
126
127
  Bug reports for the Ruby on Rails project can be filed here:
127
128
 
@@ -67,7 +67,7 @@ module ActiveJob
67
67
  false
68
68
  else
69
69
  ActiveSupport::Deprecation.warn(
70
- "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \
70
+ "Rails 6.1 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \
71
71
  " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \
72
72
  " to remove the deprecations."
73
73
  )
@@ -49,12 +49,10 @@ module ActiveJob
49
49
  # end
50
50
  def retry_on(*exceptions, wait: 3.seconds, attempts: 5, queue: nil, priority: nil)
51
51
  rescue_from(*exceptions) do |error|
52
- # Guard against jobs that were persisted before we started having individual executions counters per retry_on
53
- self.exception_executions ||= {}
54
- self.exception_executions[exceptions.to_s] = (exception_executions[exceptions.to_s] || 0) + 1
52
+ executions = executions_for(exceptions)
55
53
 
56
- if exception_executions[exceptions.to_s] < attempts
57
- retry_job wait: determine_delay(wait), queue: queue, priority: priority, error: error
54
+ if executions < attempts
55
+ retry_job wait: determine_delay(seconds_or_duration_or_algorithm: wait, executions: executions), queue: queue, priority: priority, error: error
58
56
  else
59
57
  if block_given?
60
58
  instrument :retry_stopped, error: error do
@@ -123,7 +121,7 @@ module ActiveJob
123
121
  end
124
122
 
125
123
  private
126
- def determine_delay(seconds_or_duration_or_algorithm)
124
+ def determine_delay(seconds_or_duration_or_algorithm:, executions:)
127
125
  case seconds_or_duration_or_algorithm
128
126
  when :exponentially_longer
129
127
  (executions**4) + 2
@@ -146,5 +144,14 @@ module ActiveJob
146
144
 
147
145
  ActiveSupport::Notifications.instrument("#{name}.active_job", payload, &block)
148
146
  end
147
+
148
+ def executions_for(exceptions)
149
+ if exception_executions
150
+ exception_executions[exceptions.to_s] = (exception_executions[exceptions.to_s] || 0) + 1
151
+ else
152
+ # Guard against jobs that were persisted before we started having individual executions counters per retry_on
153
+ executions
154
+ end
155
+ end
149
156
  end
150
157
  end
@@ -9,8 +9,8 @@ module ActiveJob
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
- TINY = 0
13
- PRE = "beta3"
12
+ TINY = 2
13
+ PRE = "rc2"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -10,11 +10,11 @@ module ActiveJob
10
10
  # * {Que}[https://github.com/chanks/que]
11
11
  # * {queue_classic}[https://github.com/QueueClassic/queue_classic]
12
12
  # * {Resque}[https://github.com/resque/resque]
13
- # * {Sidekiq}[http://sidekiq.org]
13
+ # * {Sidekiq}[https://sidekiq.org]
14
14
  # * {Sneakers}[https://github.com/jondot/sneakers]
15
15
  # * {Sucker Punch}[https://github.com/brandonhilkert/sucker_punch]
16
- # * {Active Job Async Job}[http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/AsyncAdapter.html]
17
- # * {Active Job Inline}[http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/InlineAdapter.html]
16
+ # * {Active Job Async Job}[https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/AsyncAdapter.html]
17
+ # * {Active Job Inline}[https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/InlineAdapter.html]
18
18
  # * Please Note: We are not accepting pull requests for new adapters. See the {README}[link:files/activejob/README_md.html] for more details.
19
19
  #
20
20
  # === Backends Features
@@ -21,7 +21,7 @@ module ActiveJob
21
21
  # Sidekiq::Client does not support symbols as keys
22
22
  job.provider_job_id = Sidekiq::Client.push \
23
23
  "class" => JobWrapper,
24
- "wrapped" => job.class.to_s,
24
+ "wrapped" => job.class,
25
25
  "queue" => job.queue_name,
26
26
  "args" => [ job.serialize ]
27
27
  end
@@ -29,7 +29,7 @@ module ActiveJob
29
29
  def enqueue_at(job, timestamp) #:nodoc:
30
30
  job.provider_job_id = Sidekiq::Client.push \
31
31
  "class" => JobWrapper,
32
- "wrapped" => job.class.to_s,
32
+ "wrapped" => job.class,
33
33
  "queue" => job.queue_name,
34
34
  "args" => [ job.serialize ],
35
35
  "at" => timestamp
@@ -353,7 +353,7 @@ module ActiveJob
353
353
  #
354
354
  #
355
355
  # The +args+ argument also accepts a proc which will get passed the actual
356
- # job's arguments. Your proc needs to returns a boolean value determining if
356
+ # job's arguments. Your proc needs to return a boolean value determining if
357
357
  # the job's arguments matches your expectation. This is useful to check only
358
358
  # for a subset of arguments.
359
359
  #
@@ -426,7 +426,7 @@ module ActiveJob
426
426
  # end
427
427
  #
428
428
  # The +args+ argument also accepts a proc which will get passed the actual
429
- # job's arguments. Your proc needs to returns a boolean value determining if
429
+ # job's arguments. Your proc needs to return a boolean value determining if
430
430
  # the job's arguments matches your expectation. This is useful to check only
431
431
  # for a subset of arguments.
432
432
  #
@@ -630,12 +630,27 @@ module ActiveJob
630
630
 
631
631
  def prepare_args_for_assertion(args)
632
632
  args.dup.tap do |arguments|
633
- arguments[:at] = arguments[:at].to_f if arguments[:at]
633
+ arguments[:at] = round_time_arguments(arguments[:at]) if arguments[:at]
634
+ arguments[:args] = round_time_arguments(arguments[:args]) if arguments[:args]
635
+ end
636
+ end
637
+
638
+ def round_time_arguments(argument)
639
+ case argument
640
+ when Time, ActiveSupport::TimeWithZone, DateTime
641
+ argument.change(usec: 0)
642
+ when Hash
643
+ argument.transform_values { |value| round_time_arguments(value) }
644
+ when Array
645
+ argument.map { |element| round_time_arguments(element) }
646
+ else
647
+ argument
634
648
  end
635
649
  end
636
650
 
637
651
  def deserialize_args_for_assertion(job)
638
652
  job.dup.tap do |new_job|
653
+ new_job[:at] = round_time_arguments(Time.at(new_job[:at])) if new_job[:at]
639
654
  new_job[:args] = ActiveJob::Arguments.deserialize(new_job[:args]) if new_job[:args]
640
655
  end
641
656
  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: 6.0.0.beta3
4
+ version: 6.0.2.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2019-12-09 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: 6.0.0.beta3
19
+ version: 6.0.2.rc2
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: 6.0.0.beta3
26
+ version: 6.0.2.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: globalid
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -90,12 +90,15 @@ files:
90
90
  - lib/rails/generators/job/job_generator.rb
91
91
  - lib/rails/generators/job/templates/application_job.rb.tt
92
92
  - lib/rails/generators/job/templates/job.rb.tt
93
- homepage: http://rubyonrails.org
93
+ homepage: https://rubyonrails.org
94
94
  licenses:
95
95
  - MIT
96
96
  metadata:
97
- source_code_uri: https://github.com/rails/rails/tree/v6.0.0.beta3/activejob
98
- changelog_uri: https://github.com/rails/rails/blob/v6.0.0.beta3/activejob/CHANGELOG.md
97
+ bug_tracker_uri: https://github.com/rails/rails/issues
98
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.2.rc2/activejob/CHANGELOG.md
99
+ documentation_uri: https://api.rubyonrails.org/v6.0.2.rc2/
100
+ mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
101
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.2.rc2/activejob
99
102
  post_install_message:
100
103
  rdoc_options: []
101
104
  require_paths:
@@ -111,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
114
  - !ruby/object:Gem::Version
112
115
  version: 1.3.1
113
116
  requirements: []
114
- rubygems_version: 3.0.1
117
+ rubygems_version: 3.0.3
115
118
  signing_key:
116
119
  specification_version: 4
117
120
  summary: Job framework with pluggable queues.