diff --git a/CHANGELOG.md b/CHANGELOG.md index 523b11922..19ba0bb40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [v3.4.5](https://github.com/bensheldon/good_job/tree/v3.4.5) (2022-09-12) + +[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.4...v3.4.5) + +**Fixed bugs:** + +- 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)) + +**Closed issues:** + +- pg\_xact No Such File error in logs [\#709](https://github.com/bensheldon/good_job/issues/709) +- Broken upgrade to v3. [\#703](https://github.com/bensheldon/good_job/issues/703) + +**Merged pull requests:** + +- Sentry integration Docs [\#711](https://github.com/bensheldon/good_job/pull/711) ([remy727](https://github.com/remy727)) +- Add an `Execution` `after_perform_unlocked` callback [\#706](https://github.com/bensheldon/good_job/pull/706) ([bensheldon](https://github.com/bensheldon)) + ## [v3.4.4](https://github.com/bensheldon/good_job/tree/v3.4.4) (2022-08-20) [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.3...v3.4.4) @@ -138,7 +156,6 @@ **Closed issues:** -- Unable to Replace GoodJob's Logger [\#667](https://github.com/bensheldon/good_job/issues/667) - Readme should consistently encourage usage of `config.good_job....` instead of `GoodJob.` configuration [\#628](https://github.com/bensheldon/good_job/issues/628) - Improve the "Gem development" section of README? [\#551](https://github.com/bensheldon/good_job/issues/551) - Simplify Rails initialization to only be a mountable Engine [\#543](https://github.com/bensheldon/good_job/issues/543) diff --git a/Gemfile.lock b/Gemfile.lock index 5388f4ae3..d4d9ebdf6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - good_job (3.4.4) + good_job (3.4.5) activejob (>= 6.0.0) activerecord (>= 6.0.0) concurrent-ruby (>= 1.0.2) diff --git a/README.md b/README.md index 69bb28bbf..815b655ec 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,7 @@ Rails.application.configure do # Configure options individually... config.good_job.preserve_job_records = true config.good_job.retry_on_unhandled_error = false - config.good_job.on_thread_error = -> (exception) { Raven.capture_exception(exception) } + config.good_job.on_thread_error = -> (exception) { Sentry.capture_exception(exception) } config.good_job.execution_mode = :async config.good_job.queues = '*' config.good_job.max_threads = 5 @@ -245,7 +245,7 @@ Rails.application.configure do config.good_job = { preserve_job_records: true, retry_on_unhandled_error: false, - on_thread_error: -> (exception) { Raven.capture_exception(exception) }, + on_thread_error: -> (exception) { Sentry.capture_exception(exception) }, execution_mode: :async, queues: '*', max_threads: 5, @@ -287,7 +287,7 @@ Available configuration options are: - `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: ```ruby - config.good_job.on_thread_error = -> (exception) { Raven.capture_exception(exception) } + config.good_job.on_thread_error = -> (exception) { Sentry.capture_exception(exception) } ``` 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 ```ruby # config/initializers/good_job.rb -GoodJob.on_thread_error = -> (exception) { Raven.capture_exception(exception) } +GoodJob.on_thread_error = -> (exception) { Sentry.capture_exception(exception) } ``` #### Retries @@ -601,13 +601,13 @@ class ApplicationJob < ActiveJob::Base retry_on StandardError, wait: :exponentially_longer, attempts: Float::INFINITY retry_on SpecialError, attempts: 5 do |_job, exception| - Raven.capture_exception(exception) + Sentry.capture_exception(exception) end around_perform do |_job, block| block.call rescue StandardError => e - Raven.capture_exception(e) + Sentry.capture_exception(e) raise end # ... @@ -630,7 +630,7 @@ ActionMailer::MailDeliveryJob.retry_on StandardError, wait: :exponentially_longe ActionMailer::MailDeliveryJob.around_perform do |_job, block| block.call rescue StandardError => e - Raven.capture_exception(e) + Sentry.capture_exception(e) raise end ``` diff --git a/app/assets/good_job/style.css b/app/assets/good_job/style.css index bfe80f49c..d1309757b 100644 --- a/app/assets/good_job/style.css +++ b/app/assets/good_job/style.css @@ -35,11 +35,6 @@ z-index: 1; } -.translation_missing { - background-color: red; - color: white; -} - .btn-outline-secondary { border-color: #ced4da; /* $gray-400 */ } diff --git a/app/models/good_job/execution.rb b/app/models/good_job/execution.rb index 2d91f3115..c1dfe6f06 100644 --- a/app/models/good_job/execution.rb +++ b/app/models/good_job/execution.rb @@ -20,6 +20,8 @@ class Execution < BaseRecord self.table_name = 'good_jobs' self.advisory_lockable_column = 'active_job_id' + define_model_callbacks :perform_unlocked, only: :after + # Parse a string representing a group of queues into a more readable data # structure. # @param string [String] Queue string @@ -202,13 +204,18 @@ def self.queue_parser(string) # raised, if any (if the job raised, then the second array entry will be # +nil+). If there were no jobs to execute, returns +nil+. def self.perform_with_advisory_lock(parsed_queues: nil) + execution = nil + result = nil unfinished.dequeueing_ordered(parsed_queues).only_scheduled.limit(1).with_advisory_lock(unlock_session: true) do |executions| execution = executions.first break if execution.blank? break :unlocked unless execution&.executable? - execution.perform + result = execution.perform end + execution&.run_callbacks(:perform_unlocked) + + result end # Fetches the scheduled execution time of the next eligible Execution(s). diff --git a/app/views/good_job/jobs/_table.erb b/app/views/good_job/jobs/_table.erb index 81db55c04..dd49024cd 100644 --- a/app/views/good_job/jobs/_table.erb +++ b/app/views/good_job/jobs/_table.erb @@ -4,6 +4,7 @@
+ <%= label_tag('toggle_job_ids', "Toggle all jobs", class: "visually-hidden") %> <%= check_box_tag('toggle_job_ids', "1", false, data: { "checkbox-toggle-all": "job_ids" }) %>
diff --git a/app/views/good_job/shared/_filter.erb b/app/views/good_job/shared/_filter.erb index 73a09f74a..105b9bc25 100644 --- a/app/views/good_job/shared/_filter.erb +++ b/app/views/good_job/shared/_filter.erb @@ -8,6 +8,7 @@ <%= hidden_field_tag :locale, params[:locale] if params[:locale] %>
+ <%= label_tag "job_queue_filter", "Queue name", class: "visually-hidden" %> @@ -28,6 +30,7 @@
+ <%= label_tag "query", "Search", class: "visually-hidden" %> <%= search_field_tag "query", params[:query], class: "form-control form-control-sm", placeholder: "Search by class, job id, job params, and error text." %>
diff --git a/checksums/good_job-3.4.5.gem.sha256 b/checksums/good_job-3.4.5.gem.sha256 new file mode 100644 index 000000000..5c55f13d3 --- /dev/null +++ b/checksums/good_job-3.4.5.gem.sha256 @@ -0,0 +1 @@ +4e3745444576f87da8fafe810fac8ac9318cf566c2083ceaa0cf3411d9d84397 diff --git a/checksums/good_job-3.4.5.gem.sha512 b/checksums/good_job-3.4.5.gem.sha512 new file mode 100644 index 000000000..0dd720a82 --- /dev/null +++ b/checksums/good_job-3.4.5.gem.sha512 @@ -0,0 +1 @@ +53f8aca557f1fa5cb6f14f99e18494760ed9d82a990d29bb88d1278ebe3d50c0a95d83174ff4ba1d8f05e5c55bd7bdd2793602209500fd254c112eaad723ba55 diff --git a/config/locales/en.yml b/config/locales/en.yml index 03b220180..d42a27d77 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -72,7 +72,6 @@ en: format: "%n%u" units: billion: B - hundred: '' million: M quadrillion: Q thousand: K diff --git a/config/locales/es.yml b/config/locales/es.yml index 9259f414e..fcfac0d16 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -72,7 +72,6 @@ es: format: "%n%u" units: billion: B - hundred: '' million: M quadrillion: q thousand: k diff --git a/config/locales/nl.yml b/config/locales/nl.yml index ef31b61ed..de2973ec1 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -72,7 +72,6 @@ nl: format: "%n%u" units: billion: B - hundred: '' million: M quadrillion: Q thousand: K diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8f943cf48..8ea4db809 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -96,7 +96,6 @@ ru: format: "%n%u" units: billion: Б - hundred: '' million: М quadrillion: Q thousand: К diff --git a/lib/good_job/adapter.rb b/lib/good_job/adapter.rb index b0ec7a128..3207cbaf7 100644 --- a/lib/good_job/adapter.rb +++ b/lib/good_job/adapter.rb @@ -60,6 +60,7 @@ def enqueue_at(active_job, timestamp) result = execution.perform ensure execution.advisory_unlock + execution.run_callbacks(:perform_unlocked) end raise result.unhandled_error if result.unhandled_error else diff --git a/lib/good_job/version.rb b/lib/good_job/version.rb index 135b565e6..331359b1d 100644 --- a/lib/good_job/version.rb +++ b/lib/good_job/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module GoodJob # GoodJob gem version. - VERSION = '3.4.4' + VERSION = '3.4.5' end