activejob 7.1.2 → 7.1.3

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: 06565d1267b4596e11732d12bd80c67c2c56804d5dc147e8d95aaa4e6ae76377
4
- data.tar.gz: da0d32071a22e4db4011275e44c1feddba2a5812686c0ff5e8f813bdfc05e49e
3
+ metadata.gz: 7ec0339a8983bf95c5187133495c6e1040c036e6d33eb4232b356b3168e49c87
4
+ data.tar.gz: 61e797a26d9b2095069dd191d0ca8771ad05e72578ca59a9ee8df6e2ccd4664d
5
5
  SHA512:
6
- metadata.gz: 68d94c0c68bb56b61f558c8e03df5c888c1968348512995f00ea40dbb5eb84776244ace807e764573da394c2b4b9631c01dff57f14f4c8a64ccdf3ad9974c0d3
7
- data.tar.gz: 13d3f3921e071c93e7b22b02338b616663a6fb79284cec4a3bce01caef46974f704cc660bb1da8801627584538baa11f74eca5c3ffe30abc669c9196faa254f7
6
+ metadata.gz: aafb4d12bc22e1579568a44fcc5a74fe23eb7a919401b367a53f4933259e5145664f82c6861f004f3dc8c0f4b1ab95e6bed0bfa3f08acb09042e148932f2e1fc
7
+ data.tar.gz: 8e805ac4f844e3529aed3bd832cb41fa29db12e847a37ca6346cb76d4ce05fe8f65350249915f6abc9be5b9e00d8692a92475eb9132ed436df2737720523023d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## Rails 7.1.3 (January 16, 2024) ##
2
+
3
+ * Do not trigger immediate loading of `ActiveJob::Base` when loading `ActiveJob::TestHelper`.
4
+
5
+ *Maxime Réty*
6
+
7
+ * Preserve the serialized timezone when deserializing `ActiveSupport::TimeWithZone` arguments.
8
+
9
+ *Joshua Young*
10
+
11
+ * Fix ActiveJob arguments serialization to correctly serialize String subclasses having custom serializers.
12
+
13
+ *fatkodima*
14
+
15
+
1
16
  ## Rails 7.1.2 (November 10, 2023) ##
2
17
 
3
18
  * No changes.
@@ -46,8 +46,6 @@ module ActiveJob
46
46
  end
47
47
 
48
48
  private
49
- # :nodoc:
50
- PERMITTED_TYPES = [ NilClass, String, Integer, Float, TrueClass, FalseClass ]
51
49
  # :nodoc:
52
50
  GLOBALID_KEY = "_aj_globalid"
53
51
  # :nodoc:
@@ -67,13 +65,23 @@ module ActiveJob
67
65
  OBJECT_SERIALIZER_KEY, OBJECT_SERIALIZER_KEY.to_sym,
68
66
  WITH_INDIFFERENT_ACCESS_KEY, WITH_INDIFFERENT_ACCESS_KEY.to_sym,
69
67
  ]
70
- private_constant :PERMITTED_TYPES, :RESERVED_KEYS, :GLOBALID_KEY,
68
+ private_constant :RESERVED_KEYS, :GLOBALID_KEY,
71
69
  :SYMBOL_KEYS_KEY, :RUBY2_KEYWORDS_KEY, :WITH_INDIFFERENT_ACCESS_KEY
72
70
 
73
71
  def serialize_argument(argument)
74
72
  case argument
75
- when *PERMITTED_TYPES
73
+ when nil, true, false, Integer, Float # Types that can hardly be subclassed
76
74
  argument
75
+ when String
76
+ if argument.class == String
77
+ argument
78
+ else
79
+ begin
80
+ Serializers.serialize(argument)
81
+ rescue SerializationError
82
+ argument
83
+ end
84
+ end
77
85
  when GlobalID::Identification
78
86
  convert_to_global_id_hash(argument)
79
87
  when Array
@@ -90,10 +98,10 @@ module ActiveJob
90
98
  result = serialize_hash(argument)
91
99
  result[aj_hash_key] = symbol_keys
92
100
  result
93
- when -> (arg) { arg.respond_to?(:permitted?) && arg.respond_to?(:to_h) }
94
- serialize_indifferent_hash(argument.to_h)
95
101
  else
96
- if BigDecimal === argument && !ActiveJob.use_big_decimal_serializer
102
+ if argument.respond_to?(:permitted?) && argument.respond_to?(:to_h)
103
+ serialize_indifferent_hash(argument.to_h)
104
+ elsif BigDecimal === argument && !ActiveJob.use_big_decimal_serializer
97
105
  ActiveJob.deprecator.warn(<<~MSG)
98
106
  Primitive serialization of BigDecimal job arguments is deprecated as it may serialize via .to_s using certain queue adapters.
99
107
  Enable config.active_job.use_big_decimal_serializer to use BigDecimalSerializer instead, which will be mandatory in Rails 7.2.
@@ -101,16 +109,16 @@ module ActiveJob
101
109
  Note that if your application has multiple replicas, you should only enable this setting after successfully deploying your app to Rails 7.1 first.
102
110
  This will ensure that during your deployment all replicas are capable of deserializing arguments serialized with BigDecimalSerializer.
103
111
  MSG
104
- return argument
112
+ argument
113
+ else
114
+ Serializers.serialize(argument)
105
115
  end
106
-
107
- Serializers.serialize(argument)
108
116
  end
109
117
  end
110
118
 
111
119
  def deserialize_argument(argument)
112
120
  case argument
113
- when *PERMITTED_TYPES
121
+ when nil, true, false, String, Integer, Float
114
122
  argument
115
123
  when BigDecimal # BigDecimal may have been legacy serialized; Remove in 7.2
116
124
  argument
@@ -132,7 +132,8 @@ module ActiveJob
132
132
  # queue_as :default
133
133
  #
134
134
  # after_enqueue do |job|
135
- # $statsd.increment "enqueue-video-job.success"
135
+ # result = job.successfully_enqueued? ? "success" : "failure"
136
+ # $statsd.increment "enqueue-video-job.#{result}"
136
137
  # end
137
138
  #
138
139
  # def perform(video_id)
@@ -9,7 +9,7 @@ module ActiveJob
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
- TINY = 2
12
+ TINY = 3
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -2,9 +2,18 @@
2
2
 
3
3
  module ActiveJob
4
4
  module Serializers
5
- class TimeWithZoneSerializer < TimeObjectSerializer # :nodoc:
5
+ class TimeWithZoneSerializer < ObjectSerializer # :nodoc:
6
+ NANO_PRECISION = 9
7
+
8
+ def serialize(time_with_zone)
9
+ super(
10
+ "value" => time_with_zone.iso8601(NANO_PRECISION),
11
+ "time_zone" => time_with_zone.time_zone.tzinfo.name
12
+ )
13
+ end
14
+
6
15
  def deserialize(hash)
7
- Time.iso8601(hash["value"]).in_time_zone
16
+ Time.iso8601(hash["value"]).in_time_zone(hash["time_zone"] || Time.zone)
8
17
  end
9
18
 
10
19
  private
@@ -34,7 +34,9 @@ module ActiveJob
34
34
  end
35
35
  end
36
36
 
37
- ActiveJob::Base.include(TestQueueAdapter)
37
+ ActiveSupport.on_load(:active_job) do
38
+ ActiveJob::Base.include(TestQueueAdapter)
39
+ end
38
40
 
39
41
  def before_setup # :nodoc:
40
42
  test_adapter = queue_adapter_for_test
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: 7.1.2
4
+ version: 7.1.3
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: 2023-11-10 00:00:00.000000000 Z
11
+ date: 2024-01-16 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: 7.1.2
19
+ version: 7.1.3
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: 7.1.2
26
+ version: 7.1.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: globalid
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -102,10 +102,10 @@ licenses:
102
102
  - MIT
103
103
  metadata:
104
104
  bug_tracker_uri: https://github.com/rails/rails/issues
105
- changelog_uri: https://github.com/rails/rails/blob/v7.1.2/activejob/CHANGELOG.md
106
- documentation_uri: https://api.rubyonrails.org/v7.1.2/
105
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.3/activejob/CHANGELOG.md
106
+ documentation_uri: https://api.rubyonrails.org/v7.1.3/
107
107
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
108
- source_code_uri: https://github.com/rails/rails/tree/v7.1.2/activejob
108
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.3/activejob
109
109
  rubygems_mfa_required: 'true'
110
110
  post_install_message:
111
111
  rdoc_options: []