good_job 3.0.1 → 3.0.2

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: 381f27d5c5f8fe4be355f3b2ea1e1f0bcd76f545d7378183b4faca9d6770a6cd
4
- data.tar.gz: 20b315936f49810e9aa70e0bc8c2a37c140436212f2e84d15e05d275c93715ee
3
+ metadata.gz: 03dafffb596eaa6c7cf0994a40586039ac38215dcb0942850b1067deec0ac04d
4
+ data.tar.gz: 917cbb1baebf9e6f8f7767d54606d0a07b02d3c28971e65369603f71500abf34
5
5
  SHA512:
6
- metadata.gz: f0f107ba18b85211856391873650309997a63e16d2ddc34e55bdbdb3f8563e595f2e3176cfaa1e13f65eaca70e75df0ff950562740d51c1a82bc885dfd3421ea
7
- data.tar.gz: cc47bc865ca1264238b5253f9ab06c8ebdc840e5adaf3220366f622626f8fac872c5fec5cd3b939acfd60137af6d984a0b2a61aad19ccd3ea277708f3c291414
6
+ metadata.gz: fd0c36fee775613d86ba832c6777eb9c72b651630f24b6236ea1b5373957d045121c3d5a0aea528cded163da638b7b6e41c3b155915186350bd1675e27b3ffee
7
+ data.tar.gz: 041f30d08e8128d81ffdbf59e19f958761b809d9993facb5919119346cfc30b2f8da715658be47e94f317ffed3953381a93141a6bdc6540ab3f0b186604970f0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.0.2](https://github.com/bensheldon/good_job/tree/v3.0.2) (2022-07-10)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.0.1...v3.0.2)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Copy forward concurrency key value when retrying a job, rather than regenerating it [\#622](https://github.com/bensheldon/good_job/issues/622)
10
+ - All concurrency controlled jobs throw exceptions and are rescheduled if they are called using perform\_now [\#591](https://github.com/bensheldon/good_job/issues/591)
11
+
12
+ **Closed issues:**
13
+
14
+ - Queue config not respecting limits [\#659](https://github.com/bensheldon/good_job/issues/659)
15
+ - UI engine does not work without explicit require [\#646](https://github.com/bensheldon/good_job/issues/646)
16
+ - Should `:inline` adapter mode retry jobs? [\#611](https://github.com/bensheldon/good_job/issues/611)
17
+ - Error Job Not Preserved [\#594](https://github.com/bensheldon/good_job/issues/594)
18
+ - Jobs never get run... [\#516](https://github.com/bensheldon/good_job/issues/516)
19
+ - Release GoodJob 3.0 [\#507](https://github.com/bensheldon/good_job/issues/507)
20
+ - Improve security of Gem releases [\#422](https://github.com/bensheldon/good_job/issues/422)
21
+
22
+ **Merged pull requests:**
23
+
24
+ - Preserve initial concurrency key when retrying jobs [\#657](https://github.com/bensheldon/good_job/pull/657) ([bensheldon](https://github.com/bensheldon))
25
+ - Add Dashboard troubleshooting note to explicitly require the engine [\#654](https://github.com/bensheldon/good_job/pull/654) ([bensheldon](https://github.com/bensheldon))
26
+ - Removes wrong parentheses [\#653](https://github.com/bensheldon/good_job/pull/653) ([esasse](https://github.com/esasse))
27
+
3
28
  ## [v3.0.1](https://github.com/bensheldon/good_job/tree/v3.0.1) (2022-07-02)
4
29
 
5
30
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.0.0...v3.0.1)
data/README.md CHANGED
@@ -370,6 +370,16 @@ GoodJob includes a Dashboard as a mountable `Rails::Engine`.
370
370
 
371
371
  See more at [Monitor and preserve worked jobs](#monitor-and-preserve-worked-jobs)
372
372
 
373
+ **Troubleshooting the Dashboard:** Some applications are unable to autoload the Goodjob Engine. To work around this, explicitly require the Engine at the top of your `config/application.rb` file, immediately after Rails is required and before Bundler requires the Rails' groups.
374
+
375
+ ```ruby
376
+ # config/application.rb
377
+ require_relative 'boot'
378
+ require 'rails/all'
379
+ require 'good_job/engine' # <= Add this line
380
+ # ...
381
+ ```
382
+
373
383
  #### API-only Rails applications
374
384
 
375
385
  API-only Rails applications may not have all of the required Rack middleware for the GoodJob Dashboard to function. To re-add the middlware:
@@ -713,7 +723,7 @@ Each GoodJob execution thread requires its own database connection that is autom
713
723
 
714
724
  ```yaml
715
725
  # config/database.yml
716
- pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5).to_i + 3 + (ENV.fetch("GOOD_JOB_MAX_THREADS", 5).to_i %>
726
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5).to_i + 3 + ENV.fetch("GOOD_JOB_MAX_THREADS", 5).to_i %>
717
727
  ```
718
728
 
719
729
  To calculate the total number of the database connections you'll need:
@@ -10,8 +10,18 @@ module GoodJob
10
10
  end
11
11
  end
12
12
 
13
+ module Prepends
14
+ def deserialize(job_data)
15
+ super
16
+ self.good_job_concurrency_key = job_data['good_job_concurrency_key']
17
+ end
18
+ end
19
+
13
20
  included do
21
+ prepend Prepends
22
+
14
23
  class_attribute :good_job_concurrency_config, instance_accessor: false, default: {}
24
+ attr_writer :good_job_concurrency_key
15
25
 
16
26
  around_enqueue do |job, block|
17
27
  # Don't attempt to enforce concurrency limits with other queue adapters.
@@ -27,6 +37,8 @@ module GoodJob
27
37
  (total_limit.present? && (0...Float::INFINITY).cover?(total_limit))
28
38
  next(block.call) unless has_limit
29
39
 
40
+ # Only generate the concurrency key on the initial enqueue in case it is dynamic
41
+ job.good_job_concurrency_key ||= job._good_job_concurrency_key
30
42
  key = job.good_job_concurrency_key
31
43
  next(block.call) if key.blank?
32
44
 
@@ -80,7 +92,15 @@ module GoodJob
80
92
  end
81
93
  end
82
94
 
95
+ # Existing or dynamically generated concurrency key
96
+ # @return [Object] concurrency key
83
97
  def good_job_concurrency_key
98
+ @good_job_concurrency_key || _good_job_concurrency_key
99
+ end
100
+
101
+ # Generates the concurrency key from the configuration
102
+ # @return [Object] concurrency key
103
+ def _good_job_concurrency_key
84
104
  key = self.class.good_job_concurrency_config[:key]
85
105
  return if key.blank?
86
106
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.0.1'
4
+ VERSION = '3.0.2'
5
5
  end
@@ -330,6 +330,7 @@ module GoodJob
330
330
  serialized_params.deep_dup
331
331
  .tap do |job_data|
332
332
  job_data["provider_job_id"] = id
333
+ job_data["good_job_concurrency_key"] = concurrency_key if concurrency_key
333
334
  end
334
335
  end
335
336
 
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.0.1
4
+ version: 3.0.2
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-07-02 00:00:00.000000000 Z
11
+ date: 2022-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob