good_job 1.12.0 → 1.13.1

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: bdf4b1eebb1224acd53f07753d5cda9cb9fde7a44baf300824d7816da94980f2
4
- data.tar.gz: 4b90c9cd8133f179f87094683218ed1a1aed3582512169dd914a00dd62a81628
3
+ metadata.gz: 945c5a01f5e0e936bbd863ce9cdcd8ca3956d1b0e8462932821ca3d502fc255f
4
+ data.tar.gz: e0503d0b3c89d43fd7a03be68f34f578100baf9b0ad01f1a7e40a6833c35a929
5
5
  SHA512:
6
- metadata.gz: e95350cb8bd69198231d8030cc07adb9c87649499d30b6aa467ad4a06244920f2e950f46eae891e6963532fa879000959fcaa2eddf6093b8cd9d960eefef9abb
7
- data.tar.gz: 1e09cf2851ca64fc34407e29f5afbac5bd7a72f072cef7c22798458b9ebc5678e287abbb03ee0d070cea8aa0665d85b017b94b68737e3e26ce7c0f67905c66e0
6
+ metadata.gz: 16326be1563033a3f94d64fa926a85d58cf9ec5026f1aed1fc1471d0b7e301c0e7f69101129964d91ca7cfafd51146fba71c5b7f2ce8643d152590ce8e826a05
7
+ data.tar.gz: ffdd7c4274c04a14d44af48d0f590fa10b984787e88e00359584911521c406451209ccd0525875ab80646bb7a9ea16fc062159b3a1513231106c7d0eb1a2e23a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,64 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.13.1](https://github.com/bensheldon/good_job/tree/v1.13.1) (2021-08-18)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.13.0...v1.13.1)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Don’t attempt to enforce concurrency limits with other queue adapters [\#333](https://github.com/bensheldon/good_job/pull/333) ([codyrobbins](https://github.com/codyrobbins))
10
+
11
+ ## [v1.13.0](https://github.com/bensheldon/good_job/tree/v1.13.0) (2021-08-18)
12
+
13
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.12.2...v1.13.0)
14
+
15
+ **Implemented enhancements:**
16
+
17
+ - Track if a GoodJob::Job has been subsequently retried [\#331](https://github.com/bensheldon/good_job/pull/331) ([bensheldon](https://github.com/bensheldon))
18
+ - Wrap and truncate error message, which can be a huge text [\#294](https://github.com/bensheldon/good_job/pull/294) ([morgoth](https://github.com/morgoth))
19
+
20
+ **Closed issues:**
21
+
22
+ - Add hyphen to lock string. e.g. "table\_name-column" instead of "table\_namecolumn [\#334](https://github.com/bensheldon/good_job/issues/334)
23
+ - Optimize db indexes in advance of v2.0.0 [\#332](https://github.com/bensheldon/good_job/issues/332)
24
+ - wait\_until in development? [\#330](https://github.com/bensheldon/good_job/issues/330)
25
+ - Race conditions in ActiveJob concurrency extension [\#325](https://github.com/bensheldon/good_job/issues/325)
26
+ - Store in database if a job has been ActiveJob retried [\#321](https://github.com/bensheldon/good_job/issues/321)
27
+ - Revisit and embrace concurrency control, scheduled jobs, and other extensions of ActiveJob [\#255](https://github.com/bensheldon/good_job/issues/255)
28
+ - Why 1 million jobs per day? [\#222](https://github.com/bensheldon/good_job/issues/222)
29
+
30
+ ## [v1.12.2](https://github.com/bensheldon/good_job/tree/v1.12.2) (2021-08-13)
31
+
32
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.12.1...v1.12.2)
33
+
34
+ **Fixed bugs:**
35
+
36
+ - Fixes for race conditions in ActiveJob concurrency extension [\#326](https://github.com/bensheldon/good_job/pull/326) ([codyrobbins](https://github.com/codyrobbins))
37
+
38
+ **Merged pull requests:**
39
+
40
+ - On gem release, add instructions to author a Github Release [\#324](https://github.com/bensheldon/good_job/pull/324) ([bensheldon](https://github.com/bensheldon))
41
+
42
+ ## [v1.12.1](https://github.com/bensheldon/good_job/tree/v1.12.1) (2021-08-05)
43
+
44
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.12.0...v1.12.1)
45
+
46
+ **Fixed bugs:**
47
+
48
+ - Ensure CLI can shutdown cleanly with multiple queues and timeout [\#319](https://github.com/bensheldon/good_job/pull/319) ([bensheldon](https://github.com/bensheldon))
49
+
50
+ **Closed issues:**
51
+
52
+ - Setting a shutdown timeout causes the CLI executor to throw an exception on shutdown. [\#318](https://github.com/bensheldon/good_job/issues/318)
53
+ - PgBouncer and prepared statements [\#269](https://github.com/bensheldon/good_job/issues/269)
54
+ - Question about locking internals [\#212](https://github.com/bensheldon/good_job/issues/212)
55
+ - Encoding::UndefinedConversionError \("\xE2" from ASCII-8BIT to UTF-8\) [\#198](https://github.com/bensheldon/good_job/issues/198)
56
+ - tools for managing a 'fleet' of processes [\#150](https://github.com/bensheldon/good_job/issues/150)
57
+
58
+ **Merged pull requests:**
59
+
60
+ - Fix Readme lint warnings [\#320](https://github.com/bensheldon/good_job/pull/320) ([bensheldon](https://github.com/bensheldon))
61
+
3
62
  ## [v1.12.0](https://github.com/bensheldon/good_job/tree/v1.12.0) (2021-07-27)
4
63
 
5
64
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v1.11.3...v1.12.0)
@@ -9,7 +68,7 @@
9
68
  - Add the ability to schedule repeating / recurring / cron-like jobs [\#53](https://github.com/bensheldon/good_job/issues/53)
10
69
  - Add cron-like support for recurring/repeating jobs [\#297](https://github.com/bensheldon/good_job/pull/297) ([bensheldon](https://github.com/bensheldon))
11
70
 
12
- **Merged pull requests:**
71
+ **Fixed bugs:**
13
72
 
14
73
  - Place Dashboard shared view partials under `good_job` namespace [\#310](https://github.com/bensheldon/good_job/pull/310) ([bensheldon](https://github.com/bensheldon))
15
74
  - Ensure Dashboard inline javascript has CSP nonce for strict Content-Security Policy [\#309](https://github.com/bensheldon/good_job/pull/309) ([bensheldon](https://github.com/bensheldon))
data/README.md CHANGED
@@ -10,7 +10,7 @@ GoodJob is a multithreaded, Postgres-based, ActiveJob backend for Ruby on Rails.
10
10
  - **Designed for ActiveJob.** Complete support for [async, queues, delays, priorities, timeouts, and retries](https://edgeguides.rubyonrails.org/active_job_basics.html) with near-zero configuration.
11
11
  - **Built for Rails.** Fully adopts Ruby on Rails [threading and code execution guidelines](https://guides.rubyonrails.org/threading_and_code_execution.html) with [Concurrent::Ruby](https://github.com/ruby-concurrency/concurrent-ruby).
12
12
  - **Backed by Postgres.** Relies upon Postgres integrity, session-level Advisory Locks to provide run-once safety and stay within the limits of `schema.rb`, and LISTEN/NOTIFY to reduce queuing latency.
13
- - **For most workloads.** Targets full-stack teams, economy-minded solo developers, and applications that enqueue less than 1-million jobs/day.
13
+ - **For most workloads.** Targets full-stack teams, economy-minded solo developers, and applications that enqueue 1-million jobs/day and more.
14
14
 
15
15
  For more of the story of GoodJob, read the [introductory blog post](https://island94.org/2020/07/introducing-goodjob-1-0).
16
16
 
@@ -52,6 +52,7 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
52
52
  - [Execute jobs async / in-process](#execute-jobs-async--in-process)
53
53
  - [Migrate to GoodJob from a different ActiveJob backend](#migrate-to-goodjob-from-a-different-activejob-backend)
54
54
  - [Monitor and preserve worked jobs](#monitor-and-preserve-worked-jobs)
55
+ - [PgBouncer compatibility](#pgbouncer-compatibility)
55
56
  - [Contribute](#contribute)
56
57
  - [Gem development](#gem-development)
57
58
  - [Release](#release)
@@ -334,7 +335,7 @@ GoodJob includes a Dashboard as a mountable `Rails::Engine`.
334
335
 
335
336
  ### ActiveJob concurrency
336
337
 
337
- GoodJob can extend ActiveJob to provide limits on concurrently running jobs, either at time of _enqueue_ or at _perform_.
338
+ GoodJob can extend ActiveJob to provide limits on concurrently running jobs, either at time of _enqueue_ or at _perform_. Limiting concurrency can help prevent duplicate, double or unecessary jobs from being enqueued, or race conditions when performing, for example when interacting with 3rd-party APIs.
338
339
 
339
340
  **Note:** Limiting concurrency at _enqueue_ requires Rails 6.0+ because Rails 5.2 does not support `throw :abort` in ActiveJob callbacks.
340
341
 
@@ -361,6 +362,13 @@ class MyJob < ApplicationJob
361
362
  end
362
363
  ```
363
364
 
365
+ When testing, the resulting concurrency key value can be inspected:
366
+
367
+ ```ruby
368
+ job = MyJob.perform_later("Alice")
369
+ job.good_job_concurrency_key #=> "Unique-Alice"
370
+ ```
371
+
364
372
  ### Cron-style repeating/recurring jobs
365
373
 
366
374
  GoodJob can enqueue jobs on a recurring basis that can be used as a replacement for cron.
@@ -680,6 +688,43 @@ It is also necessary to delete these preserved jobs from the database after a ce
680
688
  $ bundle exec good_job cleanup_preserved_jobs --before-seconds-ago=86400
681
689
  ```
682
690
 
691
+ ### PgBouncer compatibility
692
+
693
+ GoodJob is not compatible with PgBouncer in _transaction_ mode, but is compatible with PgBouncer's _connection_ mode. GoodJob uses connection-based advisory locks and LISTEN/NOTIFY, both of which require full database connections.
694
+
695
+ A workaround to this limitation is to make a direct database connection available to GoodJob. With Rails 6.0's support for [multiple databases](https://guides.rubyonrails.org/active_record_multiple_databases.html), a direct connection to the database can be configured:
696
+
697
+ 1. Define a direct connection to your database that is not proxied through PgBouncer, for example:
698
+
699
+ ```yml
700
+ # config/database.yml
701
+
702
+ production:
703
+ primary:
704
+ url: postgres://pgbouncer_host/my_database
705
+ primary_direct:
706
+ url: postgres://database_host/my_database
707
+ ```
708
+
709
+ 1. Create a new ActiveRecord base class that uses the direct database connection
710
+
711
+ ```ruby
712
+ # app/models/application_direct_record.rb
713
+
714
+ class ApplicationDirectRecord < ActiveRecord::Base
715
+ self.abstract_class = true
716
+ connects_to database: :primary_direct
717
+ end
718
+ ```
719
+
720
+ 1. Configure GoodJob to use the newly created ActiveRecord base class:
721
+
722
+ ```ruby
723
+ # config/initializers/good_job.rb
724
+
725
+ GoodJob.active_record_parent_class = "ApplicationDirectRecord"
726
+ ```
727
+
683
728
  ## Contribute
684
729
 
685
730
  Contributions are welcomed and appreciated 🙏
@@ -19,7 +19,7 @@
19
19
  <td><%= job.serialized_params['job_class'] %></td>
20
20
  <td><%= job.queue_name %></td>
21
21
  <td><%= job.scheduled_at || job.created_at %></td>
22
- <td><%= job.error %></td>
22
+ <td class="text-break"><%= truncate(job.error, length: 1_000) %></td>
23
23
  <td>
24
24
  <%= tag.button "Preview", type: "button", class: "btn btn-sm btn-outline-primary", role: "button",
25
25
  data: {bs_toggle: "collapse", bs_target: "##{dom_id(job, 'params')}"},
@@ -16,6 +16,7 @@ class CreateGoodJobs < ActiveRecord::Migration[5.2]
16
16
  t.uuid :active_job_id
17
17
  t.text :concurrency_key
18
18
  t.text :cron_key
19
+ t.uuid :retried_good_job_id
19
20
  end
20
21
 
21
22
  add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: "index_good_jobs_on_scheduled_at"
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ class AddRetriedGoodJobIdToGoodJobs < ActiveRecord::Migration[5.2]
3
+ def change
4
+ reversible do |dir|
5
+ dir.up do
6
+ # Ensure this incremental update migration is idempotent
7
+ # with monolithic install migration.
8
+ return if connection.column_exists?(:good_jobs, :retried_good_job_id)
9
+ end
10
+ end
11
+
12
+ add_column :good_jobs, :retried_good_job_id, :uuid
13
+ end
14
+ end
data/lib/good_job.rb CHANGED
@@ -126,13 +126,13 @@ module GoodJob
126
126
  _shutdown_all(_executables, :restart, timeout: timeout)
127
127
  end
128
128
 
129
- # Sends +#shutdown+ or +#restart+ to executable objects ({GoodJob::Notifier}, {GoodJob::Poller}, {GoodJob::Scheduler})
130
- # @param executables [Array<Notifier, Poller, Scheduler, MultiScheduler>] Objects to shut down.
129
+ # Sends +#shutdown+ or +#restart+ to executable objects ({GoodJob::Notifier}, {GoodJob::Poller}, {GoodJob::Scheduler}, {GoodJob::MultiScheduler}, {GoodJob::CronManager})
130
+ # @param executables [Array<Notifier, Poller, Scheduler, MultiScheduler, CronManager>] Objects to shut down.
131
131
  # @param method_name [:symbol] Method to call, e.g. +:shutdown+ or +:restart+.
132
132
  # @param timeout [nil,Numeric]
133
133
  # @return [void]
134
134
  def self._shutdown_all(executables, method_name = :shutdown, timeout: -1)
135
- if timeout.positive?
135
+ if timeout.is_a?(Numeric) && timeout.positive?
136
136
  executables.each { |executable| executable.send(method_name, timeout: nil) }
137
137
 
138
138
  stop_at = Time.current + timeout
@@ -9,21 +9,24 @@ module GoodJob
9
9
  included do
10
10
  class_attribute :good_job_concurrency_config, instance_accessor: false, default: {}
11
11
 
12
- before_enqueue do |job|
12
+ around_enqueue do |job, block|
13
+ # Don't attempt to enforce concurrency limits with other queue adapters.
14
+ next(block.call) unless job.class.queue_adapter.is_a?(GoodJob::Adapter)
15
+
13
16
  # Always allow jobs to be retried because the current job's execution will complete momentarily
14
- next if CurrentExecution.active_job_id == job.job_id
17
+ next(block.call) if CurrentExecution.active_job_id == job.job_id
15
18
 
16
19
  limit = job.class.good_job_concurrency_config.fetch(:enqueue_limit, Float::INFINITY)
17
- next if limit.blank? || (0...Float::INFINITY).exclude?(limit)
20
+ next(block.call) if limit.blank? || (0...Float::INFINITY).exclude?(limit)
18
21
 
19
22
  key = job.good_job_concurrency_key
20
- next if key.blank?
23
+ next(block.call) if key.blank?
21
24
 
22
25
  GoodJob::Job.new.with_advisory_lock(key: key, function: "pg_advisory_lock") do
23
26
  # TODO: Why is `unscoped` necessary? Nested scope is bleeding into subsequent query?
24
27
  enqueue_concurrency = GoodJob::Job.unscoped.where(concurrency_key: key).unfinished.count
25
28
  # The job has not yet been enqueued, so check if adding it will go over the limit
26
- throw :abort if enqueue_concurrency + 1 > limit
29
+ block.call unless enqueue_concurrency + 1 > limit
27
30
  end
28
31
  end
29
32
 
@@ -34,6 +37,9 @@ module GoodJob
34
37
  )
35
38
 
36
39
  before_perform do |job|
40
+ # Don't attempt to enforce concurrency limits with other queue adapters.
41
+ next unless job.class.queue_adapter.is_a?(GoodJob::Adapter)
42
+
37
43
  limit = job.class.good_job_concurrency_config.fetch(:perform_limit, Float::INFINITY)
38
44
  next if limit.blank? || (0...Float::INFINITY).exclude?(limit)
39
45
 
@@ -41,9 +47,9 @@ module GoodJob
41
47
  next if key.blank?
42
48
 
43
49
  GoodJob::Job.new.with_advisory_lock(key: key, function: "pg_advisory_lock") do
44
- perform_concurrency = GoodJob::Job.unscoped.where(concurrency_key: key).advisory_locked.count
50
+ allowed_active_job_ids = GoodJob::Job.unscoped.where(concurrency_key: key).advisory_locked.order(Arel.sql("COALESCE(performed_at, scheduled_at, created_at) ASC")).limit(limit).pluck(:active_job_id)
45
51
  # The current job has already been locked and will appear in the previous query
46
- raise GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError if perform_concurrency > limit
52
+ raise GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError unless allowed_active_job_ids.include? job.job_id
47
53
  end
48
54
  end
49
55
  end
@@ -5,12 +5,6 @@ module GoodJob
5
5
  # Thread-local attributes for passing values from Instrumentation.
6
6
  # (Cannot use ActiveSupport::CurrentAttributes because ActiveJob resets it)
7
7
  module CurrentExecution
8
- # @!attribute [rw] active_job_id
9
- # @!scope class
10
- # ActiveJob ID
11
- # @return [String, nil]
12
- thread_mattr_accessor :active_job_id
13
-
14
8
  # @!attribute [rw] cron_key
15
9
  # @!scope class
16
10
  # Cron Key
@@ -29,14 +23,26 @@ module GoodJob
29
23
  # @return [Exception, nil]
30
24
  thread_mattr_accessor :error_on_retry
31
25
 
26
+ # @!attribute [rw] good_job
27
+ # @!scope class
28
+ # Cron Key
29
+ # @return [GoodJob::Job, nil]
30
+ thread_mattr_accessor :good_job
31
+
32
32
  # Resets attributes
33
33
  # @return [void]
34
34
  def self.reset
35
- self.active_job_id = nil
35
+ self.cron_key = nil
36
+ self.good_job = nil
36
37
  self.error_on_discard = nil
37
38
  self.error_on_retry = nil
38
39
  end
39
40
 
41
+ # @return [String] UUID of the currently executing GoodJob::Job
42
+ def self.active_job_id
43
+ good_job&.active_job_id
44
+ end
45
+
40
46
  # @return [Integer] Current process ID
41
47
  def self.process_id
42
48
  Process.pid
data/lib/good_job/job.rb CHANGED
@@ -52,6 +52,20 @@ module GoodJob
52
52
  end
53
53
  end
54
54
 
55
+ def self._migration_pending_warning
56
+ ActiveSupport::Deprecation.warn(<<~DEPRECATION)
57
+ GoodJob has pending database migrations. To create the migration files, run:
58
+
59
+ rails generate good_job:update
60
+
61
+ To apply the migration files, run:
62
+
63
+ rails db:migrate
64
+
65
+ DEPRECATION
66
+ nil
67
+ end
68
+
55
69
  # Get Jobs with given class name
56
70
  # @!method with_job_class
57
71
  # @!scope class
@@ -110,6 +124,18 @@ module GoodJob
110
124
  # @return [ActiveRecord::Relation]
111
125
  scope :running, -> { where.not(performed_at: nil).where(finished_at: nil) }
112
126
 
127
+ # Get Jobs that do not have subsequent retries
128
+ # @!method running
129
+ # @!scope class
130
+ # @return [ActiveRecord::Relation]
131
+ scope :head, -> { where(retried_good_job_id: nil) }
132
+
133
+ # Get Jobs have errored that will not be retried further
134
+ # @!method running
135
+ # @!scope class
136
+ # @return [ActiveRecord::Relation]
137
+ scope :dead, -> { head.where.not(error: nil) }
138
+
113
139
  # Get Jobs on queues that match the given queue string.
114
140
  # @!method queue_string(string)
115
141
  # @!scope class
@@ -199,7 +225,6 @@ module GoodJob
199
225
  def self.enqueue(active_job, scheduled_at: nil, create_with_advisory_lock: false)
200
226
  ActiveSupport::Notifications.instrument("enqueue_job.good_job", { active_job: active_job, scheduled_at: scheduled_at, create_with_advisory_lock: create_with_advisory_lock }) do |instrument_payload|
201
227
  good_job_args = {
202
- cron_key: CurrentExecution.cron_key,
203
228
  queue_name: active_job.queue_name.presence || DEFAULT_QUEUE_NAME,
204
229
  priority: active_job.priority || DEFAULT_PRIORITY,
205
230
  serialized_params: active_job.serialize,
@@ -210,31 +235,23 @@ module GoodJob
210
235
  if column_names.include?('active_job_id')
211
236
  good_job_args[:active_job_id] = active_job.job_id
212
237
  else
213
- ActiveSupport::Deprecation.warn(<<~DEPRECATION)
214
- GoodJob has pending database migrations. To create the migration files, run:
215
-
216
- rails generate good_job:update
217
-
218
- To apply the migration files, run:
219
-
220
- rails db:migrate
221
-
222
- DEPRECATION
238
+ _migration_pending_warning
223
239
  end
224
240
 
225
241
  if column_names.include?('concurrency_key')
226
242
  good_job_args[:concurrency_key] = active_job.good_job_concurrency_key if active_job.respond_to?(:good_job_concurrency_key)
227
243
  else
228
- ActiveSupport::Deprecation.warn(<<~DEPRECATION)
229
- GoodJob has pending database migrations. To create the migration files, run:
230
-
231
- rails generate good_job:update
232
-
233
- To apply the migration files, run:
234
-
235
- rails db:migrate
244
+ _migration_pending_warning
245
+ end
236
246
 
237
- DEPRECATION
247
+ if column_names.include?('cron_key')
248
+ if CurrentExecution.cron_key
249
+ good_job_args[:cron_key] = CurrentExecution.cron_key
250
+ elsif CurrentExecution.active_job_id == active_job.job_id
251
+ good_job_args[:cron_key] = CurrentExecution.good_job.cron_key
252
+ end
253
+ else
254
+ _migration_pending_warning
238
255
  end
239
256
 
240
257
  good_job = GoodJob::Job.new(**good_job_args)
@@ -244,6 +261,12 @@ module GoodJob
244
261
  good_job.save!
245
262
  active_job.provider_job_id = good_job.id
246
263
 
264
+ if column_names.include?('retried_good_job_id')
265
+ CurrentExecution.good_job.retried_good_job_id = good_job.id if CurrentExecution.good_job && CurrentExecution.good_job.active_job_id == active_job.job_id
266
+ else
267
+ _migration_pending_warning
268
+ end
269
+
247
270
  good_job
248
271
  end
249
272
  end
@@ -283,24 +306,19 @@ module GoodJob
283
306
  end
284
307
 
285
308
  def active_job_id
286
- super || serialized_params['job_id']
309
+ if self.class.column_names.include?('active_job_id')
310
+ super
311
+ else
312
+ self.class._migration_pending_warning
313
+ serialized_params['job_id']
314
+ end
287
315
  end
288
316
 
289
317
  def cron_key
290
318
  if self.class.column_names.include?('cron_key')
291
319
  super
292
320
  else
293
- ActiveSupport::Deprecation.warn(<<~DEPRECATION)
294
- GoodJob has pending database migrations. To create the migration files, run:
295
-
296
- rails generate good_job:update
297
-
298
- To apply the migration files, run:
299
-
300
- rails db:migrate
301
-
302
- DEPRECATION
303
-
321
+ self.class._migration_pending_warning
304
322
  nil
305
323
  end
306
324
  end
@@ -314,8 +332,7 @@ module GoodJob
314
332
  )
315
333
 
316
334
  GoodJob::CurrentExecution.reset
317
- GoodJob::CurrentExecution.active_job_id = active_job_id
318
- GoodJob::CurrentExecution.cron_key = cron_key
335
+ GoodJob::CurrentExecution.good_job = self
319
336
  ActiveSupport::Notifications.instrument("perform_job.good_job", { good_job: self, process_id: GoodJob::CurrentExecution.process_id, thread_name: GoodJob::CurrentExecution.thread_name }) do
320
337
  value = ActiveJob::Base.execute(params)
321
338
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '1.12.0'
4
+ VERSION = '1.13.1'
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: 1.12.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-27 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -374,6 +374,7 @@ files:
374
374
  - lib/generators/good_job/templates/update/migrations/01_create_good_jobs.rb
375
375
  - lib/generators/good_job/templates/update/migrations/02_add_active_job_id_concurrency_key_cron_key_to_good_jobs.rb
376
376
  - lib/generators/good_job/templates/update/migrations/03_add_active_job_id_index_and_concurrency_key_index_to_good_jobs.rb
377
+ - lib/generators/good_job/templates/update/migrations/04_add_retried_good_job_id_to_good_jobs.rb
377
378
  - lib/generators/good_job/update_generator.rb
378
379
  - lib/good_job.rb
379
380
  - lib/good_job/active_job_extensions.rb