good_job 4.9.1 → 4.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 257efee85262d3d49be021082bc73cce8dfcf2bea117841a31862bb592158593
4
- data.tar.gz: d5adc70dcd2894ce5190e07eab45e322c7724f74d96f5a4ccf96bee3c1b35798
3
+ metadata.gz: 11143bd2b5c2841e11678c93f3632485b0bc9dd23927454c07ffc6d1e6b0abea
4
+ data.tar.gz: 5e2681807571802f1ee335fcc689f27e2aba2a13fe4cc1d633813d1bd949c0cb
5
5
  SHA512:
6
- metadata.gz: 003cb3656a88bcd02e8354e315dff667a284d3cae0674ff8b5f73a7cbcfd0ed1b60faf27ff23b14a1d83e395209d4292cfb8e6d771835c4a9418c8ff1977b327
7
- data.tar.gz: c13483d1ac9f15a720b161905cab041f2c52f7305568b885bfeb0c7fbc514662023cde9ff87fe09f99811536285265aa3d3a4aa31113f73c026f1d39a5521b88
6
+ metadata.gz: 92b3e5bc089532cac4fe541f1e265915e0ca480f0067e2f1662e2f17d40f8af6c9e983d716fc4405a412dfd86d913c16132654c879b368055ee060f0a93336ce
7
+ data.tar.gz: a2fe5af27f4dd8ee1afe6ad312d3218d3eff2b8776f87d3d9047db13119f2a9f5d53f9866aa51e3cacb6146f306a4127fc55bf1b503b80c1be7754a356d275d3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.9.3](https://github.com/bensheldon/good_job/tree/v4.9.3) (2025-03-10)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.9.2...v4.9.3)
6
+
7
+ **Closed issues:**
8
+
9
+ - perform\_job.good\_job notification for successful jobs has error\_event: :discarded [\#1609](https://github.com/bensheldon/good_job/issues/1609)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Fix instrumentation of "perform\_job.good\_job" event [\#1616](https://github.com/bensheldon/good_job/pull/1616) ([bensheldon](https://github.com/bensheldon))
14
+
15
+ ## [v4.9.2](https://github.com/bensheldon/good_job/tree/v4.9.2) (2025-03-09)
16
+
17
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.9.1...v4.9.2)
18
+
19
+ **Fixed bugs:**
20
+
21
+ - Quiet duplicate cron enqueue logging by pretending it was halted at before\_enqueue [\#1615](https://github.com/bensheldon/good_job/pull/1615) ([bensheldon](https://github.com/bensheldon))
22
+
3
23
  ## [v4.9.1](https://github.com/bensheldon/good_job/tree/v4.9.1) (2025-03-09)
4
24
 
5
25
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.9.0...v4.9.1)
@@ -110,8 +110,6 @@ module GoodJob # :nodoc:
110
110
  kwargs_value.present? ? configured_job.perform_later(*args_value, **kwargs_value) : configured_job.perform_later(*args_value)
111
111
  end
112
112
  end
113
- rescue ActiveRecord::RecordNotUnique
114
- false
115
113
  end
116
114
 
117
115
  def display_properties
@@ -9,7 +9,7 @@ module GoodJob
9
9
  attr_reader :handled_error
10
10
  # @return [Exception, nil]
11
11
  attr_reader :unhandled_error
12
- # @return [String, nil]
12
+ # @return [Symbol, nil]
13
13
  attr_reader :error_event
14
14
  # @return [Boolean, nil]
15
15
  attr_reader :unexecutable
@@ -387,7 +387,16 @@ module GoodJob
387
387
  end
388
388
 
389
389
  instrument_payload[:job] = job
390
- job.save!
390
+ begin
391
+ job.save!
392
+ rescue ActiveRecord::RecordNotUnique
393
+ raise unless job.cron_key
394
+
395
+ # Active Job doesn't have a clean way to cancel an enqueue for unexceptional reasons
396
+ # This is a workaround to mark it as having been halted in before_enqueue
397
+ active_job.send(:halted_callback_hook, "duplicate_cron_key", "good_job")
398
+ return false
399
+ end
391
400
 
392
401
  CurrentThread.retried_job = job if retried
393
402
 
@@ -633,8 +642,9 @@ module GoodJob
633
642
  value = nil
634
643
  end
635
644
  handled_error ||= current_thread.error_on_retry || current_thread.error_on_discard
636
-
637
- error_event = if handled_error == current_thread.error_on_discard
645
+ error_event = if !handled_error
646
+ nil
647
+ elsif handled_error == current_thread.error_on_discard
638
648
  :discarded
639
649
  elsif handled_error == current_thread.error_on_retry
640
650
  :retried
@@ -646,6 +656,7 @@ module GoodJob
646
656
 
647
657
  instrument_payload.merge!(
648
658
  value: value,
659
+ error: handled_error,
649
660
  handled_error: handled_error,
650
661
  retried: current_thread.retried_job.present?,
651
662
  error_event: error_event
@@ -660,7 +671,11 @@ module GoodJob
660
671
  :unhandled
661
672
  end
662
673
 
663
- instrument_payload[:unhandled_error] = e
674
+ instrument_payload.merge!(
675
+ error: e,
676
+ unhandled_error: e,
677
+ error_event: error_event
678
+ )
664
679
  ExecutionResult.new(value: nil, unhandled_error: e, error_event: error_event)
665
680
  end
666
681
  end
@@ -163,8 +163,10 @@ module GoodJob
163
163
  scheduled_at: scheduled_at
164
164
  )
165
165
 
166
- executed_locally = execute_async? && @capsule&.create_thread(job.job_state)
167
- Notifier.notify(job.job_state) if !executed_locally && send_notify?(active_job)
166
+ if job
167
+ executed_locally = execute_async? && @capsule&.create_thread(job.job_state)
168
+ Notifier.notify(job.job_state) if !executed_locally && send_notify?(active_job)
169
+ end
168
170
  end
169
171
 
170
172
  job
@@ -2,7 +2,7 @@
2
2
 
3
3
  module GoodJob
4
4
  # GoodJob gem version.
5
- VERSION = '4.9.1'
5
+ VERSION = '4.9.3'
6
6
 
7
7
  # GoodJob version as Gem::Version object
8
8
  GEM_VERSION = Gem::Version.new(VERSION)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.1
4
+ version: 4.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-09 00:00:00.000000000 Z
10
+ date: 2025-03-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activejob