good_job 4.9.3 → 4.10.0

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: 11143bd2b5c2841e11678c93f3632485b0bc9dd23927454c07ffc6d1e6b0abea
4
- data.tar.gz: 5e2681807571802f1ee335fcc689f27e2aba2a13fe4cc1d633813d1bd949c0cb
3
+ metadata.gz: 464fe8415569d7b3a2e09f1ae95052ae8349969cb9086ee56e85d7d02a161de8
4
+ data.tar.gz: 9c1dd45dc3e99d9ed218a7123a38ab6f106ebf8b93871af86655d5ee9cf3a64f
5
5
  SHA512:
6
- metadata.gz: 92b3e5bc089532cac4fe541f1e265915e0ca480f0067e2f1662e2f17d40f8af6c9e983d716fc4405a412dfd86d913c16132654c879b368055ee060f0a93336ce
7
- data.tar.gz: a2fe5af27f4dd8ee1afe6ad312d3218d3eff2b8776f87d3d9047db13119f2a9f5d53f9866aa51e3cacb6146f306a4127fc55bf1b503b80c1be7754a356d275d3
6
+ metadata.gz: 2270c9d1fdd9c0b953f921ac873ffed572270907ce1d99cbb92b1ddb63b9afa979603af20aacbd2b01745b4e76743966d5851ab1a742f60fcb29258aaef5cae9
7
+ data.tar.gz: 62802abd14cd93633bc7667bf42b74cbeb7bb420de6a85f3dd0fa7e93aad63eb0714f52976d80b527152bd6e7746a231a17fd46a15f8674ec7e90149df410b05
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.10.0](https://github.com/bensheldon/good_job/tree/v4.10.0) (2025-04-26)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.9.3...v4.10.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Improve dashboard performance when searching for job ID [\#1619](https://github.com/bensheldon/good_job/pull/1619) ([francois](https://github.com/francois))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - Fix Batches dashboard deserealization error [\#1628](https://github.com/bensheldon/good_job/pull/1628) ([JulianPasquale](https://github.com/JulianPasquale))
14
+ - Fix enqueue\_after\_transaction\_commit config [\#1626](https://github.com/bensheldon/good_job/pull/1626) ([santib](https://github.com/santib))
15
+
16
+ **Closed issues:**
17
+
18
+ - Retried jobs with GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError lose their arguments [\#1620](https://github.com/bensheldon/good_job/issues/1620)
19
+ - Searching for job ID fails on Heroku due to 30s request limit [\#1618](https://github.com/bensheldon/good_job/issues/1618)
20
+ - Poor performance when enqueuing many throttled jobs because of unindexed queries [\#1603](https://github.com/bensheldon/good_job/issues/1603)
21
+
22
+ **Merged pull requests:**
23
+
24
+ - Update `GoodJob.migrated?` for latest migration [\#1631](https://github.com/bensheldon/good_job/pull/1631) ([Earlopain](https://github.com/Earlopain))
25
+
3
26
  ## [v4.9.3](https://github.com/bensheldon/good_job/tree/v4.9.3) (2025-03-10)
4
27
 
5
28
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.9.2...v4.9.3)
@@ -2,6 +2,8 @@
2
2
 
3
3
  module GoodJob
4
4
  class JobsFilter < BaseFilter
5
+ UUID_REGEX = /\A[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\z/i
6
+
5
7
  def state_names
6
8
  %w[scheduled retried queued running succeeded discarded]
7
9
  end
@@ -25,7 +27,16 @@ module GoodJob
25
27
 
26
28
  query = query.job_class(filter_params[:job_class]) if filter_params[:job_class].present?
27
29
  query = query.where(queue_name: filter_params[:queue_name]) if filter_params[:queue_name].present?
28
- query = query.search_text(filter_params[:query]) if filter_params[:query].present?
30
+
31
+ search_query = filter_params[:query]&.strip
32
+ if search_query.present?
33
+ query = if query_is_uuid_and_job_exists?(search_query)
34
+ query.where(active_job_id: search_query)
35
+ else
36
+ query.search_text(search_query)
37
+ end
38
+ end
39
+
29
40
  query = query.where(cron_key: filter_params[:cron_key]) if filter_params[:cron_key].present?
30
41
  query = query.where(finished_at: finished_since(filter_params[:finished_since])..) if filter_params[:finished_since].present?
31
42
 
@@ -90,5 +101,9 @@ module GoodJob
90
101
  7.days.ago
91
102
  end
92
103
  end
104
+
105
+ def query_is_uuid_and_job_exists?(search_query)
106
+ @_query_is_uuid_and_job_exists ||= search_query&.match?(UUID_REGEX) && base_query.exists?(active_job_id: search_query)
107
+ end
93
108
  end
94
109
  end
@@ -40,7 +40,19 @@ module GoodJob
40
40
  end
41
41
 
42
42
  def display_attributes
43
- attributes.except('serialized_properties').merge(properties: properties)
43
+ display_properties = begin
44
+ serialized_properties
45
+ rescue ActiveJob::DeserializationError
46
+ JSON.parse(read_attribute_before_type_cast(:serialized_properties))
47
+ end
48
+
49
+ attribute_names.to_h do |name|
50
+ if name == "serialized_properties"
51
+ ["properties", display_properties]
52
+ else
53
+ [name, self[name]]
54
+ end
55
+ end
44
56
  end
45
57
 
46
58
  def _continue_discard_or_finish(job = nil, lock: true)
@@ -249,6 +249,13 @@ module GoodJob
249
249
  Arel.sql('integer')
250
250
  )
251
251
  end
252
+
253
+ def concurrency_key_created_at_index_migrated?
254
+ return true if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_concurrency_key_and_created_at)
255
+
256
+ migration_pending_warning!
257
+ false
258
+ end
252
259
  end
253
260
 
254
261
  def self.build_for_enqueue(active_job, scheduled_at: nil)
@@ -76,7 +76,7 @@
76
76
  </div>
77
77
  </div>
78
78
  <%= tag.div id: dom_id(batch, "properties"), class: "batch-properties list-group-item collapse small bg-dark text-light" do %>
79
- <%= tag.pre JSON.pretty_generate(batch.properties) %>
79
+ <%= tag.pre JSON.pretty_generate(batch.display_attributes["properties"]) %>
80
80
  <% end %>
81
81
  <% end %>
82
82
  <% else %>
@@ -367,6 +367,7 @@ module GoodJob
367
367
  # @return [Boolean]
368
368
  def enqueue_after_transaction_commit
369
369
  return options[:enqueue_after_transaction_commit] unless options[:enqueue_after_transaction_commit].nil?
370
+ return rails_config[:enqueue_after_transaction_commit] unless rails_config[:enqueue_after_transaction_commit].nil?
370
371
 
371
372
  DEFAULT_ENQUEUE_AFTER_TRANSACTION_COMMIT
372
373
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module GoodJob
4
4
  # GoodJob gem version.
5
- VERSION = '4.9.3'
5
+ VERSION = '4.10.0'
6
6
 
7
7
  # GoodJob version as Gem::Version object
8
8
  GEM_VERSION = Gem::Version.new(VERSION)
data/lib/good_job.rb CHANGED
@@ -290,7 +290,7 @@ module GoodJob
290
290
  # For use in tests/CI to validate GoodJob is up-to-date.
291
291
  # @return [Boolean]
292
292
  def self.migrated?
293
- GoodJob::BatchRecord.jobs_finished_at_migrated?
293
+ GoodJob::Job.concurrency_key_created_at_index_migrated?
294
294
  end
295
295
 
296
296
  # Pause job execution for a given queue or job class.
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.3
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activejob
@@ -240,9 +240,9 @@ executables:
240
240
  - good_job
241
241
  extensions: []
242
242
  extra_rdoc_files:
243
- - README.md
244
243
  - CHANGELOG.md
245
244
  - LICENSE.txt
245
+ - README.md
246
246
  files:
247
247
  - CHANGELOG.md
248
248
  - LICENSE.txt
@@ -421,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
421
421
  - !ruby/object:Gem::Version
422
422
  version: '0'
423
423
  requirements: []
424
- rubygems_version: 3.6.2
424
+ rubygems_version: 3.6.8
425
425
  specification_version: 4
426
426
  summary: A multithreaded, Postgres-based ActiveJob backend for Ruby on Rails
427
427
  test_files: []