activejob 7.0.0 → 7.0.1

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: 7ae2d6cd0db3d7b8f537207fc2a1ca24c367a99d342f5df41f528a36d78b8bdc
4
- data.tar.gz: f4fa7e7a47dbfc76f27efb80784da27ea752e7c439ced3cda38be6dd9433ad9b
3
+ metadata.gz: 943b9e02ac6352d3cefdc94020e3bc61ac959dc208a6022790b0861b400c32e1
4
+ data.tar.gz: 90cb82d17339efe5a4cb3abe10566f48fdcb983fe8c6b29422fd33bd128b2f38
5
5
  SHA512:
6
- metadata.gz: 3f69f0725c4795278cbec6122722ff8646855a27590c32b8fe01bf2c2d11b7f3d5ebb55480dc22328bd71ed101402c6a5d7b7566545899b97faf4ea67b099821
7
- data.tar.gz: d2d1bda340ca28b512243d1feae203482a4f965746723329d135fedf6b0a100eb658cb9b8108e12d57c04a494b419cb3d4843c9c19a9265ee83af3082520873b
6
+ metadata.gz: a731c1d1a4af3dc7edf881b16ec4c71a6139d52955651614a43f7e53ad198782d0657b61bf8ac14ebf27a31112ea84b0a18aa89dcd161c73fbb6780308d99f5d
7
+ data.tar.gz: 5631dfff92392136050ffa785016c5afa8a163c325fff32351652d8cb6a29dc193125bf6431022c11000b6d3db1353581ac63cee1008c72680457d9b7eb338ec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ ## Rails 7.0.1 (January 06, 2022) ##
2
+
3
+ * Allow testing `discard_on/retry_on ActiveJob::DeserializationError`
4
+
5
+ Previously in `perform_enqueued_jobs`, `deserialize_arguments_if_needed`
6
+ was called before calling `perform_now`. When a record no longer exists
7
+ and is serialized using GlobalID this led to raising
8
+ an `ActiveJob::DeserializationError` before reaching `perform_now` call.
9
+ This behaviour makes difficult testing the job `discard_on/retry_on` logic.
10
+
11
+ Now `deserialize_arguments_if_needed` call is postponed to when `perform_now`
12
+ is called.
13
+
14
+ Example:
15
+
16
+ ```ruby
17
+ class UpdateUserJob < ActiveJob::Base
18
+ discard_on ActiveJob::DeserializationError
19
+
20
+ def perform(user)
21
+ # ...
22
+ end
23
+ end
24
+
25
+ # In the test
26
+ User.destroy_all
27
+ assert_nothing_raised do
28
+ perform_enqueued_jobs only: UpdateUserJob
29
+ end
30
+ ```
31
+
32
+ *Jacopo Beschi*
33
+
34
+
1
35
  ## Rails 7.0.0 (December 15, 2021) ##
2
36
 
3
37
  * No changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2021 David Heinemeier Hansson
1
+ Copyright (c) 2014-2022 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -9,7 +9,7 @@ module ActiveJob
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
- TINY = 0
12
+ TINY = 1
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -688,7 +688,7 @@ module ActiveJob
688
688
  enqueued_jobs_with(only: only, except: except, queue: queue, at: at) do |payload|
689
689
  queue_adapter.enqueued_jobs.delete(payload)
690
690
  queue_adapter.performed_jobs << payload
691
- instantiate_job(payload).perform_now
691
+ instantiate_job(payload, skip_deserialize_arguments: true).perform_now
692
692
  end.count
693
693
  end
694
694
 
@@ -708,10 +708,10 @@ module ActiveJob
708
708
  end
709
709
  end
710
710
 
711
- def instantiate_job(payload)
711
+ def instantiate_job(payload, skip_deserialize_arguments: false)
712
712
  job = payload[:job].deserialize(payload)
713
713
  job.scheduled_at = Time.at(payload[:at]) if payload.key?(:at)
714
- job.send(:deserialize_arguments_if_needed)
714
+ job.send(:deserialize_arguments_if_needed) unless skip_deserialize_arguments
715
715
  job
716
716
  end
717
717
 
data/lib/active_job.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright (c) 2014-2021 David Heinemeier Hansson
4
+ # Copyright (c) 2014-2022 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
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.0.0
4
+ version: 7.0.1
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: 2021-12-15 00:00:00.000000000 Z
11
+ date: 2022-01-06 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.0.0
19
+ version: 7.0.1
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.0.0
26
+ version: 7.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: globalid
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -100,10 +100,10 @@ licenses:
100
100
  - MIT
101
101
  metadata:
102
102
  bug_tracker_uri: https://github.com/rails/rails/issues
103
- changelog_uri: https://github.com/rails/rails/blob/v7.0.0/activejob/CHANGELOG.md
104
- documentation_uri: https://api.rubyonrails.org/v7.0.0/
103
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.1/activejob/CHANGELOG.md
104
+ documentation_uri: https://api.rubyonrails.org/v7.0.1/
105
105
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
106
- source_code_uri: https://github.com/rails/rails/tree/v7.0.0/activejob
106
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.1/activejob
107
107
  rubygems_mfa_required: 'true'
108
108
  post_install_message:
109
109
  rdoc_options: []