good_job 3.13.0 → 3.14.0

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: c83cf253d12daeb00363fe9c1b3a06b463c6944aa108aa4f884bf43b0d1f5c88
4
- data.tar.gz: 71738f01485fb73b1dfa71396807f4570922d53aa186bf7aa1f9c27b21e4e559
3
+ metadata.gz: 1c0893de944702ad430a2ac00b8e47d740bad60a12a5ae4d009d7c0bcfbeefac
4
+ data.tar.gz: bdddfd0a48ba4c93c6a255f31a90eee482b1af65b6fd128973235370ab469c01
5
5
  SHA512:
6
- metadata.gz: 25bbd078a94d5079b47d57c267ad72f7e6baa024230add7fd9c693c621eb8be7117aa517f715baba5b16cb5f0378eb0e407a41ea1569e923a16716ef0f4d391b
7
- data.tar.gz: cf58cbaea01a1dd6714b53c6d618661908ccf46ef3deae58b3e2d6063f512e528d0d4f04850e7a3c4a1ccc59ece959a0919d19898488116898f78b9c78c7a5f6
6
+ metadata.gz: 3dc31d6cb250ad3fd6494718a282aea4982e0e47f3337d4b0601bb8e46bd958edf84ff6e28fa583c45b4071ca1fc68c0deee0f4a763fb98505ea2d4e65d3547e
7
+ data.tar.gz: 3937ac0c805118d9ed4c09c7dda525b5dd913190129c2f6bb3bbffe8cc9100716325374d004c86aa6cb623d84a3f5392acea19cbd1bcfbaf0c4585ed9adf7043
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.14.0](https://github.com/bensheldon/good_job/tree/v3.14.0) (2023-03-09)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.13.0...v3.14.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Deprecate definition of job priority, change to "smaller number is higher priority" to align with Active Job definition [\#883](https://github.com/bensheldon/good_job/pull/883) ([bensheldon](https://github.com/bensheldon))
10
+
3
11
  ## [v3.13.0](https://github.com/bensheldon/good_job/tree/v3.13.0) (2023-03-08)
4
12
 
5
13
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.8...v3.13.0)
@@ -108,7 +108,13 @@ module GoodJob
108
108
  # @!method priority_ordered
109
109
  # @!scope class
110
110
  # @return [ActiveRecord::Relation]
111
- scope :priority_ordered, -> { order('priority DESC NULLS LAST') }
111
+ scope :priority_ordered, (lambda do
112
+ if GoodJob.configuration.smaller_number_is_higher_priority
113
+ order('priority ASC NULLS LAST')
114
+ else
115
+ order('priority DESC NULLS LAST')
116
+ end
117
+ end)
112
118
 
113
119
  # Order executions by created_at, for first-in first-out
114
120
  # @!method creation_ordered
@@ -206,6 +212,14 @@ module GoodJob
206
212
 
207
213
  # Construct a GoodJob::Execution from an ActiveJob instance.
208
214
  def self.build_for_enqueue(active_job, overrides = {})
215
+ if active_job.priority && GoodJob.configuration.smaller_number_is_higher_priority.nil?
216
+ ActiveSupport::Deprecation.warn(<<~DEPRECATION)
217
+ The next major version of GoodJob (v4.0) will change job `priority` to give smaller numbers higher priority (default: `0`), in accordance with Active Job's definition of priority.
218
+ To opt-in to this behavior now, set `config.good_job.smaller_number_is_higher_priority = true` in your GoodJob initializer or application.rb.
219
+ To not opt-in yet, but silence this deprecation warning, set `config.good_job.smaller_number_is_higher_priority = false`.
220
+ DEPRECATION
221
+ end
222
+
209
223
  execution_args = {
210
224
  active_job_id: active_job.job_id,
211
225
  queue_name: active_job.queue_name.presence || DEFAULT_QUEUE_NAME,
@@ -341,6 +341,10 @@ module GoodJob
341
341
  DEFAULT_ENABLE_LISTEN_NOTIFY
342
342
  end
343
343
 
344
+ def smaller_number_is_higher_priority
345
+ rails_config[:smaller_number_is_higher_priority]
346
+ end
347
+
344
348
  private
345
349
 
346
350
  def rails_config
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.13.0'
4
+ VERSION = '3.14.0'
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.13.0
4
+ version: 3.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-08 00:00:00.000000000 Z
11
+ date: 2023-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob