activejob 7.1.2 → 7.1.3
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 +15 -0
- data/lib/active_job/arguments.rb +19 -11
- data/lib/active_job/callbacks.rb +2 -1
- data/lib/active_job/gem_version.rb +1 -1
- data/lib/active_job/serializers/time_with_zone_serializer.rb +11 -2
- data/lib/active_job/test_helper.rb +3 -1
- metadata +7 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7ec0339a8983bf95c5187133495c6e1040c036e6d33eb4232b356b3168e49c87
         | 
| 4 | 
            +
              data.tar.gz: 61e797a26d9b2095069dd191d0ca8771ad05e72578ca59a9ee8df6e2ccd4664d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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.
         | 
    
        data/lib/active_job/arguments.rb
    CHANGED
    
    | @@ -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 : | 
| 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  | 
| 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  | 
| 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 | 
            -
                         | 
| 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  | 
| 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
         | 
    
        data/lib/active_job/callbacks.rb
    CHANGED
    
    | @@ -132,7 +132,8 @@ module ActiveJob | |
| 132 132 | 
             
                  #     queue_as :default
         | 
| 133 133 | 
             
                  #
         | 
| 134 134 | 
             
                  #     after_enqueue do |job|
         | 
| 135 | 
            -
                  #        | 
| 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)
         | 
| @@ -2,9 +2,18 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module ActiveJob
         | 
| 4 4 | 
             
              module Serializers
         | 
| 5 | 
            -
                class TimeWithZoneSerializer <  | 
| 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
         | 
    
        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. | 
| 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:  | 
| 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. | 
| 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. | 
| 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. | 
| 106 | 
            -
              documentation_uri: https://api.rubyonrails.org/v7.1. | 
| 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. | 
| 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: []
         |