good_job 3.4.4 → 3.4.6

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: c54a7908e5803c8f247421375b0ca4a09f97d5b0d21131ef2bfc54e91a4c7eed
4
- data.tar.gz: 8a616c9407d2844ee89e2f12fa71c197ddb60e693983c66ce664ac413d0676f0
3
+ metadata.gz: 9f6f46bc81c3d161377238784c24c81deb1f06480b4fd49cd87192bff37bed60
4
+ data.tar.gz: a7e1d948e9bd98a94128f61fc8b12b32627ec2b828d36e7b06baa272c304a00e
5
5
  SHA512:
6
- metadata.gz: 0040cd9afa69d73d4c9bf09da90bd7c1e4c73d4dc4251faff13fd495e2c39d081d099163482edb332a392be1dd560ac056705a5261363e8172d2ae7eab20be55
7
- data.tar.gz: c4e41bd8da8e2afd309fceb2c0c5eb4b042d85234c4d34f4a687bcb2fe63f9e2f7d0c442c07bf68a248201d5e9c42c2e84dc8022c9f3eace8ea0b97c3995e004
6
+ metadata.gz: 69db268ef55985004f348fa62d7c07e82e10d961b9667a16367fec4a5af11ff05daf9e1ac9a064946e6d41434a9fabf9ea3bce7ced52a8bca342c876e1168d8e
7
+ data.tar.gz: 234f79a1ee23c7609f5e22b3a0c4e3d883e67011ed28f68befae868b9ac252adb6869e8261ef9af3a754da105edf93701fc8525cc81e487b8e30b6d94c636850
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.4.6](https://github.com/bensheldon/good_job/tree/v3.4.6) (2022-09-26)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.5...v3.4.6)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Support SemanticLogger logging with improve stdout logic and tagged logs [\#715](https://github.com/bensheldon/good_job/pull/715) ([bensheldon](https://github.com/bensheldon))
10
+
11
+ **Closed issues:**
12
+
13
+ - Unable to Replace GoodJob's Logger [\#667](https://github.com/bensheldon/good_job/issues/667)
14
+ - Jobs never get run... [\#516](https://github.com/bensheldon/good_job/issues/516)
15
+
16
+ ## [v3.4.5](https://github.com/bensheldon/good_job/tree/v3.4.5) (2022-09-12)
17
+
18
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.4...v3.4.5)
19
+
20
+ **Fixed bugs:**
21
+
22
+ - Dashboard: Remove translation\_missing red highlighting; remove number\_to\_human.hundreds; add form labels [\#708](https://github.com/bensheldon/good_job/pull/708) ([bensheldon](https://github.com/bensheldon))
23
+
24
+ **Closed issues:**
25
+
26
+ - pg\_xact No Such File error in logs [\#709](https://github.com/bensheldon/good_job/issues/709)
27
+ - Broken upgrade to v3. [\#703](https://github.com/bensheldon/good_job/issues/703)
28
+
29
+ **Merged pull requests:**
30
+
31
+ - Sentry integration Docs [\#711](https://github.com/bensheldon/good_job/pull/711) ([remy727](https://github.com/remy727))
32
+ - Add an `Execution` `after_perform_unlocked` callback [\#706](https://github.com/bensheldon/good_job/pull/706) ([bensheldon](https://github.com/bensheldon))
33
+
3
34
  ## [v3.4.4](https://github.com/bensheldon/good_job/tree/v3.4.4) (2022-08-20)
4
35
 
5
36
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.3...v3.4.4)
@@ -138,7 +169,6 @@
138
169
 
139
170
  **Closed issues:**
140
171
 
141
- - Unable to Replace GoodJob's Logger [\#667](https://github.com/bensheldon/good_job/issues/667)
142
172
  - Readme should consistently encourage usage of `config.good_job....` instead of `GoodJob.` configuration [\#628](https://github.com/bensheldon/good_job/issues/628)
143
173
  - Improve the "Gem development" section of README? [\#551](https://github.com/bensheldon/good_job/issues/551)
144
174
  - Simplify Rails initialization to only be a mountable Engine [\#543](https://github.com/bensheldon/good_job/issues/543)
@@ -192,7 +222,6 @@
192
222
  - UI engine does not work without explicit require [\#646](https://github.com/bensheldon/good_job/issues/646)
193
223
  - Should `:inline` adapter mode retry jobs? [\#611](https://github.com/bensheldon/good_job/issues/611)
194
224
  - Error Job Not Preserved [\#594](https://github.com/bensheldon/good_job/issues/594)
195
- - Jobs never get run... [\#516](https://github.com/bensheldon/good_job/issues/516)
196
225
  - Release GoodJob 3.0 [\#507](https://github.com/bensheldon/good_job/issues/507)
197
226
  - Improve security of Gem releases [\#422](https://github.com/bensheldon/good_job/issues/422)
198
227
 
data/README.md CHANGED
@@ -232,7 +232,7 @@ Rails.application.configure do
232
232
  # Configure options individually...
233
233
  config.good_job.preserve_job_records = true
234
234
  config.good_job.retry_on_unhandled_error = false
235
- config.good_job.on_thread_error = -> (exception) { Raven.capture_exception(exception) }
235
+ config.good_job.on_thread_error = -> (exception) { Sentry.capture_exception(exception) }
236
236
  config.good_job.execution_mode = :async
237
237
  config.good_job.queues = '*'
238
238
  config.good_job.max_threads = 5
@@ -245,7 +245,7 @@ Rails.application.configure do
245
245
  config.good_job = {
246
246
  preserve_job_records: true,
247
247
  retry_on_unhandled_error: false,
248
- on_thread_error: -> (exception) { Raven.capture_exception(exception) },
248
+ on_thread_error: -> (exception) { Sentry.capture_exception(exception) },
249
249
  execution_mode: :async,
250
250
  queues: '*',
251
251
  max_threads: 5,
@@ -287,7 +287,7 @@ Available configuration options are:
287
287
  - `on_thread_error` (proc, lambda, or callable) will be called when an Exception. It can be useful for logging errors to bug tracking services, like Sentry or Airbrake. Example:
288
288
 
289
289
  ```ruby
290
- config.good_job.on_thread_error = -> (exception) { Raven.capture_exception(exception) }
290
+ config.good_job.on_thread_error = -> (exception) { Sentry.capture_exception(exception) }
291
291
  ```
292
292
 
293
293
  By default, GoodJob configures the following execution modes per environment:
@@ -567,7 +567,7 @@ If errors do reach GoodJob, you can assign a callable to `GoodJob.on_thread_erro
567
567
 
568
568
  ```ruby
569
569
  # config/initializers/good_job.rb
570
- GoodJob.on_thread_error = -> (exception) { Raven.capture_exception(exception) }
570
+ GoodJob.on_thread_error = -> (exception) { Sentry.capture_exception(exception) }
571
571
  ```
572
572
 
573
573
  #### Retries
@@ -601,13 +601,13 @@ class ApplicationJob < ActiveJob::Base
601
601
  retry_on StandardError, wait: :exponentially_longer, attempts: Float::INFINITY
602
602
 
603
603
  retry_on SpecialError, attempts: 5 do |_job, exception|
604
- Raven.capture_exception(exception)
604
+ Sentry.capture_exception(exception)
605
605
  end
606
606
 
607
607
  around_perform do |_job, block|
608
608
  block.call
609
609
  rescue StandardError => e
610
- Raven.capture_exception(e)
610
+ Sentry.capture_exception(e)
611
611
  raise
612
612
  end
613
613
  # ...
@@ -630,7 +630,7 @@ ActionMailer::MailDeliveryJob.retry_on StandardError, wait: :exponentially_longe
630
630
  ActionMailer::MailDeliveryJob.around_perform do |_job, block|
631
631
  block.call
632
632
  rescue StandardError => e
633
- Raven.capture_exception(e)
633
+ Sentry.capture_exception(e)
634
634
  raise
635
635
  end
636
636
  ```
@@ -35,11 +35,6 @@
35
35
  z-index: 1;
36
36
  }
37
37
 
38
- .translation_missing {
39
- background-color: red;
40
- color: white;
41
- }
42
-
43
38
  .btn-outline-secondary {
44
39
  border-color: #ced4da; /* $gray-400 */
45
40
  }
@@ -20,6 +20,8 @@ module GoodJob
20
20
  self.table_name = 'good_jobs'
21
21
  self.advisory_lockable_column = 'active_job_id'
22
22
 
23
+ define_model_callbacks :perform_unlocked, only: :after
24
+
23
25
  # Parse a string representing a group of queues into a more readable data
24
26
  # structure.
25
27
  # @param string [String] Queue string
@@ -202,13 +204,18 @@ module GoodJob
202
204
  # raised, if any (if the job raised, then the second array entry will be
203
205
  # +nil+). If there were no jobs to execute, returns +nil+.
204
206
  def self.perform_with_advisory_lock(parsed_queues: nil)
207
+ execution = nil
208
+ result = nil
205
209
  unfinished.dequeueing_ordered(parsed_queues).only_scheduled.limit(1).with_advisory_lock(unlock_session: true) do |executions|
206
210
  execution = executions.first
207
211
  break if execution.blank?
208
212
  break :unlocked unless execution&.executable?
209
213
 
210
- execution.perform
214
+ result = execution.perform
211
215
  end
216
+ execution&.run_callbacks(:perform_unlocked)
217
+
218
+ result
212
219
  end
213
220
 
214
221
  # Fetches the scheduled execution time of the next eligible Execution(s).
@@ -4,6 +4,7 @@
4
4
  <header class="list-group-item bg-light">
5
5
  <div class="row small text-muted text-uppercase align-items-center">
6
6
  <div class="col-auto">
7
+ <%= label_tag('toggle_job_ids', "Toggle all jobs", class: "visually-hidden") %>
7
8
  <%= check_box_tag('toggle_job_ids', "1", false, data: { "checkbox-toggle-all": "job_ids" }) %>
8
9
  </div>
9
10
  <div class="col-4">
@@ -8,6 +8,7 @@
8
8
  <%= hidden_field_tag :locale, params[:locale] if params[:locale] %>
9
9
  <div class="d-flex flex-row w-100">
10
10
  <div class="me-2">
11
+ <%= label_tag "job_queue_filter", "Queue name", class: "visually-hidden" %>
11
12
  <select name="queue_name" id="job_queue_filter" class="form-select form-select-sm">
12
13
  <option value="" <%= "selected='selected'" if params[:queue_name].blank? %>>All queues</option>
13
14
 
@@ -18,6 +19,7 @@
18
19
  </div>
19
20
 
20
21
  <div class="me-2">
22
+ <%= label_tag "job_class_filter", "Job name", class: "visually-hidden" %>
21
23
  <select name="job_class" id="job_class_filter" class="form-select form-select-sm">
22
24
  <option value="" <%= "selected='selected'" if params[:job_class].blank? %>>All jobs</option>
23
25
 
@@ -28,6 +30,7 @@
28
30
  </div>
29
31
 
30
32
  <div class="me-2 flex-fill">
33
+ <%= label_tag "query", "Search", class: "visually-hidden" %>
31
34
  <%= search_field_tag "query", params[:query], class: "form-control form-control-sm", placeholder: "Search by class, job id, job params, and error text." %>
32
35
  </div>
33
36
 
@@ -72,7 +72,6 @@ en:
72
72
  format: "%n%u"
73
73
  units:
74
74
  billion: B
75
- hundred: ''
76
75
  million: M
77
76
  quadrillion: Q
78
77
  thousand: K
@@ -72,7 +72,6 @@ es:
72
72
  format: "%n%u"
73
73
  units:
74
74
  billion: B
75
- hundred: ''
76
75
  million: M
77
76
  quadrillion: q
78
77
  thousand: k
@@ -72,7 +72,6 @@ nl:
72
72
  format: "%n%u"
73
73
  units:
74
74
  billion: B
75
- hundred: ''
76
75
  million: M
77
76
  quadrillion: Q
78
77
  thousand: K
@@ -96,7 +96,6 @@ ru:
96
96
  format: "%n%u"
97
97
  units:
98
98
  billion: Б
99
- hundred: ''
100
99
  million: М
101
100
  quadrillion: Q
102
101
  thousand: К
@@ -60,6 +60,7 @@ module GoodJob
60
60
  result = execution.perform
61
61
  ensure
62
62
  execution.advisory_unlock
63
+ execution.run_callbacks(:perform_unlocked)
63
64
  end
64
65
  raise result.unhandled_error if result.unhandled_error
65
66
  else
data/lib/good_job/cli.rb CHANGED
@@ -156,7 +156,7 @@ module GoodJob
156
156
  # Rails or from the application can be set up here.
157
157
  def set_up_application!
158
158
  require RAILS_ENVIRONMENT_RB
159
- return unless GoodJob::CLI.log_to_stdout? && !ActiveSupport::Logger.logger_outputs_to?(GoodJob.logger, $stdout)
159
+ return if !GoodJob::CLI.log_to_stdout? || ActiveSupport::Logger.logger_outputs_to?(GoodJob.logger, $stdout)
160
160
 
161
161
  GoodJob::LogSubscriber.loggers << ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new($stdout))
162
162
  GoodJob::LogSubscriber.reset_logger
@@ -206,7 +206,7 @@ module GoodJob
206
206
  good_job_tag = ["ActiveJob"].freeze
207
207
 
208
208
  self.class.loggers.inject(block) do |inner, each_logger|
209
- if each_logger.respond_to?(:tagged) && each_logger.formatter
209
+ if each_logger.respond_to?(:tagged) && each_logger.try(:formatter).try(:current_tags).respond_to?(:include?)
210
210
  tags_for_logger = if each_logger.formatter.current_tags.include?("ActiveJob")
211
211
  good_job_tag + tags
212
212
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.4.4'
4
+ VERSION = '3.4.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.4
4
+ version: 3.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-20 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob