good_job 4.19.1 → 4.19.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 +4 -4
- data/CHANGELOG.md +39 -1
- data/README.md +4 -4
- data/app/models/concerns/good_job/advisory_lockable.rb +3 -3
- data/app/models/good_job/batch.rb +6 -0
- data/app/models/good_job/job.rb +7 -6
- data/lib/good_job/configuration.rb +1 -4
- data/lib/good_job/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ad85ff0a870b41065fedac7c97b85f06606227b8a508851d775fabf90d2cc44
|
|
4
|
+
data.tar.gz: b4060b5afd727017bc337833d5c3d152f8f08465077edc42cbba9f929da72452
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6f6a889caf1e0566fb98b18603fabcfde6f2499cffc96d9ddec3eb3fd15e1049d32d2e16a0c42284410d43bd6bb849b57f5e54ac3dea989a1e9eba929a42034
|
|
7
|
+
data.tar.gz: f671e1ee8a746c4f771339d4f5afdd2da089e16934129462890645b44ebd013f13568feb1e278df06fb84ce49a1020e43f0813c481da60e16008d7b7944c05cf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v4.19.2](https://github.com/bensheldon/good_job/tree/v4.19.2) (2026-07-20)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.19.1...v4.19.2)
|
|
6
|
+
|
|
7
|
+
**Fixed bugs:**
|
|
8
|
+
|
|
9
|
+
- Resolve connection pool at call time in the `adapter_class` shim [\#1798](https://github.com/bensheldon/good_job/pull/1798) ([DaisyOli](https://github.com/DaisyOli))
|
|
10
|
+
- Add GoodJob::Batch.where\(id:\) for GlobalID::Locator.fetch [\#1792](https://github.com/bensheldon/good_job/pull/1792) ([bensheldon](https://github.com/bensheldon))
|
|
11
|
+
- Preserve created\_at when a job is retried [\#1789](https://github.com/bensheldon/good_job/pull/1789) ([ollym](https://github.com/ollym))
|
|
12
|
+
|
|
13
|
+
**Closed issues:**
|
|
14
|
+
|
|
15
|
+
- Memoized `adapter_class` proxy captures the pre-fork connection pool, crashing the Notifier in forked Puma workers \(Rails \< 7.2 + `preload_app!`\) [\#1797](https://github.com/bensheldon/good_job/issues/1797)
|
|
16
|
+
- created\_at is reset every time a job is retried [\#1788](https://github.com/bensheldon/good_job/issues/1788)
|
|
17
|
+
|
|
18
|
+
**Merged pull requests:**
|
|
19
|
+
|
|
20
|
+
- Fix JRuby CI failure installing `rbs` gem [\#1794](https://github.com/bensheldon/good_job/pull/1794) ([bensheldon](https://github.com/bensheldon))
|
|
21
|
+
- Fix flaky scheduled\_at precision comparison in adapter\_spec [\#1793](https://github.com/bensheldon/good_job/pull/1793) ([bensheldon](https://github.com/bensheldon))
|
|
22
|
+
- Remove inline\_execution\_respects\_schedule config [\#1791](https://github.com/bensheldon/good_job/pull/1791) ([bensheldon](https://github.com/bensheldon))
|
|
23
|
+
- Bump actions/checkout from 6 to 7 [\#1787](https://github.com/bensheldon/good_job/pull/1787) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
24
|
+
|
|
3
25
|
## [v4.19.1](https://github.com/bensheldon/good_job/tree/v4.19.1) (2026-06-25)
|
|
4
26
|
|
|
5
27
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.19.0...v4.19.1)
|
|
@@ -134,6 +156,10 @@
|
|
|
134
156
|
|
|
135
157
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.16.0...v4.17.0)
|
|
136
158
|
|
|
159
|
+
**Implemented enhancements:**
|
|
160
|
+
|
|
161
|
+
- Introduce advisory lock key customization support methods [\#1722](https://github.com/bensheldon/good_job/pull/1722) ([amkisko](https://github.com/amkisko))
|
|
162
|
+
|
|
137
163
|
**Merged pull requests:**
|
|
138
164
|
|
|
139
165
|
- Convert UI JavaScript modules to Stimulus controllers [\#1743](https://github.com/bensheldon/good_job/pull/1743) ([bensheldon](https://github.com/bensheldon))
|
|
@@ -149,6 +175,11 @@
|
|
|
149
175
|
- Allow filtering by label on dashboard [\#1739](https://github.com/bensheldon/good_job/pull/1739) ([bensheldon](https://github.com/bensheldon))
|
|
150
176
|
- Allow multiple concurrency rules per job via labels [\#1700](https://github.com/bensheldon/good_job/pull/1700) ([bscofield](https://github.com/bscofield))
|
|
151
177
|
|
|
178
|
+
**Fixed bugs:**
|
|
179
|
+
|
|
180
|
+
- Fix advisory lock connection stickiness in block contexts [\#1736](https://github.com/bensheldon/good_job/pull/1736) ([bensheldon](https://github.com/bensheldon))
|
|
181
|
+
- Add JRuby 10 to testing matrix [\#1559](https://github.com/bensheldon/good_job/pull/1559) ([bensheldon](https://github.com/bensheldon))
|
|
182
|
+
|
|
152
183
|
**Closed issues:**
|
|
153
184
|
|
|
154
185
|
- Job duration misreported if interrupted [\#1723](https://github.com/bensheldon/good_job/issues/1723)
|
|
@@ -158,6 +189,7 @@
|
|
|
158
189
|
- Use annotated git tag in release script [\#1741](https://github.com/bensheldon/good_job/pull/1741) ([bensheldon](https://github.com/bensheldon))
|
|
159
190
|
- Double single-thread scheduler integration test timeout on JRuby [\#1738](https://github.com/bensheldon/good_job/pull/1738) ([bensheldon](https://github.com/bensheldon))
|
|
160
191
|
- Fix JRuby test flakes for scheduler timeout and interrupted execution duration [\#1737](https://github.com/bensheldon/good_job/pull/1737) ([bensheldon](https://github.com/bensheldon))
|
|
192
|
+
- Count Advisory Locks and refactor advisory lock lifecycle [\#1735](https://github.com/bensheldon/good_job/pull/1735) ([bensheldon](https://github.com/bensheldon))
|
|
161
193
|
- Show interrupted execution recovery duration in dashboard [\#1733](https://github.com/bensheldon/good_job/pull/1733) ([bensheldon](https://github.com/bensheldon))
|
|
162
194
|
- chore: use `merge` to avoid mutate the query object [\#1717](https://github.com/bensheldon/good_job/pull/1717) ([luizkowalski](https://github.com/luizkowalski))
|
|
163
195
|
|
|
@@ -173,6 +205,7 @@
|
|
|
173
205
|
|
|
174
206
|
**Merged pull requests:**
|
|
175
207
|
|
|
208
|
+
- Fix JRuby in development lockfile, with test [\#1734](https://github.com/bensheldon/good_job/pull/1734) ([bensheldon](https://github.com/bensheldon))
|
|
176
209
|
- Add herb to linter [\#1732](https://github.com/bensheldon/good_job/pull/1732) ([bensheldon](https://github.com/bensheldon))
|
|
177
210
|
- Update development dependencies; apply Rubocop to\_h lints [\#1728](https://github.com/bensheldon/good_job/pull/1728) ([bensheldon](https://github.com/bensheldon))
|
|
178
211
|
|
|
@@ -234,6 +267,7 @@
|
|
|
234
267
|
|
|
235
268
|
**Fixed bugs:**
|
|
236
269
|
|
|
270
|
+
- Check for graceful shutdown inside job cleanup loops [\#1711](https://github.com/bensheldon/good_job/pull/1711) ([bdewater-thatch](https://github.com/bdewater-thatch))
|
|
237
271
|
- Add title to Good Job Dashboard layout [\#1701](https://github.com/bensheldon/good_job/pull/1701) ([mockdeep](https://github.com/mockdeep))
|
|
238
272
|
|
|
239
273
|
**Closed issues:**
|
|
@@ -329,6 +363,7 @@
|
|
|
329
363
|
**Merged pull requests:**
|
|
330
364
|
|
|
331
365
|
- Update sorbet/tapioca [\#1681](https://github.com/bensheldon/good_job/pull/1681) ([bensheldon](https://github.com/bensheldon))
|
|
366
|
+
- Remove obsolete property from tests [\#1676](https://github.com/bensheldon/good_job/pull/1676) ([RDIL](https://github.com/RDIL))
|
|
332
367
|
- Bump actions/checkout from 4 to 5 [\#1673](https://github.com/bensheldon/good_job/pull/1673) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
333
368
|
|
|
334
369
|
## [v4.11.2](https://github.com/bensheldon/good_job/tree/v4.11.2) (2025-08-06)
|
|
@@ -451,6 +486,10 @@
|
|
|
451
486
|
|
|
452
487
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.9.0...v4.9.1)
|
|
453
488
|
|
|
489
|
+
**Implemented enhancements:**
|
|
490
|
+
|
|
491
|
+
- Order Dashboard jobs in more "natural" order [\#1604](https://github.com/bensheldon/good_job/pull/1604) ([francois](https://github.com/francois))
|
|
492
|
+
|
|
454
493
|
**Fixed bugs:**
|
|
455
494
|
|
|
456
495
|
- \[dashboard\] Scheduled tasks are shown "backwards" [\#1580](https://github.com/bensheldon/good_job/issues/1580)
|
|
@@ -1936,7 +1975,6 @@
|
|
|
1936
1975
|
- In tests, directly use `connection.truncate_tables` instead of `ActiveRecord::Tasks::DatabaseTasks.truncate_all` [\#918](https://github.com/bensheldon/good_job/pull/918) ([bensheldon](https://github.com/bensheldon))
|
|
1937
1976
|
- Use `GoodJob.capsule` in CLI instead of creating a new Capsule [\#916](https://github.com/bensheldon/good_job/pull/916) ([bensheldon](https://github.com/bensheldon))
|
|
1938
1977
|
- Fix lint: missing fr and nl translations; readme whitespace [\#914](https://github.com/bensheldon/good_job/pull/914) ([bensheldon](https://github.com/bensheldon))
|
|
1939
|
-
- Switches from Chrome to Chromium to support Apple M1/Arm CPUs [\#910](https://github.com/bensheldon/good_job/pull/910) ([ckdake](https://github.com/ckdake))
|
|
1940
1978
|
- Bump erb\_lint from 0.3.1 to 0.4.0 [\#906](https://github.com/bensheldon/good_job/pull/906) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
1941
1979
|
|
|
1942
1980
|
## [v3.15.0](https://github.com/bensheldon/good_job/tree/v3.15.0) (2023-04-02)
|
data/README.md
CHANGED
|
@@ -315,7 +315,6 @@ Available configuration options are:
|
|
|
315
315
|
- `cleanup_preserved_jobs_before_seconds_ago` (integer) number of seconds to preserve jobs when using the `$ good_job cleanup_preserved_jobs` CLI command or calling `GoodJob.cleanup_preserved_jobs`. Defaults to `1209600` (14 days). Can also be set with the environment variable `GOOD_JOB_CLEANUP_PRESERVED_JOBS_BEFORE_SECONDS_AGO`.
|
|
316
316
|
- `cleanup_interval_jobs` (integer) Number of jobs a Scheduler will execute before cleaning up preserved jobs. Defaults to `1000`. Disable with `false`. Can also be set with the environment variable `GOOD_JOB_CLEANUP_INTERVAL_JOBS` and disabled with `0`).
|
|
317
317
|
- `cleanup_interval_seconds` (integer) Number of seconds a Scheduler will wait before cleaning up preserved jobs. Defaults to `600` (10 minutes). Disable with `false`. Can also be set with the environment variable `GOOD_JOB_CLEANUP_INTERVAL_SECONDS` and disabled with `0`).
|
|
318
|
-
- `inline_execution_respects_schedule` (boolean) Opt-in to future behavior of inline execution respecting scheduled jobs. Defaults to `false`.
|
|
319
318
|
- `logger` ([Rails Logger](https://api.rubyonrails.org/classes/ActiveSupport/Logger.html)) lets you set a custom logger for GoodJob. It should be an instance of a Rails `Logger` (Default: `Rails.logger`).
|
|
320
319
|
- `preserve_job_records` (boolean, symbol, or lambda) keeps job records in your database even after jobs are completed. If set to `true`, all job records are preserved. If set to `:on_unhandled_error`, only jobs that finished with an unhandled error are preserved. If set to a lambda, the lambda will be called with the error_event (e.g., `:discarded`, `:retry_stopped`, or `:unhandled`) and should return a boolean indicating whether to preserve the job. (Default: `true`)
|
|
321
320
|
- `advisory_lock_heartbeat` (boolean) whether to use an advisory lock for the purpose of determining whether an execeution process is active. (Default `true` in Development; `false` in other environments)
|
|
@@ -339,6 +338,9 @@ Available configuration options are:
|
|
|
339
338
|
```
|
|
340
339
|
|
|
341
340
|
- `enable_pauses` (boolean) whether job processing can be paused. Defaults to `false`. You can also set this with the environment variable `GOOD_JOB_ENABLE_PAUSES`.
|
|
341
|
+
- `dequeue_query_sort` (symbol) sets the sort order used when querying for the next job(s) to execute. Defaults to `:created_at`. It can be any one of:
|
|
342
|
+
- `:created_at` sorts by priority, then job creation order. This is the default, but no longer best matches GoodJob's contemporary data model.
|
|
343
|
+
- `:scheduled_at` sorts by priority, then `scheduled_at`, then `id`, which better matches GoodJob's contemporary data model. This will become the default/only behavior in a future major release.
|
|
342
344
|
|
|
343
345
|
By default, GoodJob configures the following execution modes per environment:
|
|
344
346
|
|
|
@@ -1505,9 +1507,7 @@ It is also possible to manually trigger a cleanup of preserved job records:
|
|
|
1505
1507
|
|
|
1506
1508
|
By default, GoodJob uses its inline adapter in the test environment; the inline adapter is designed for the test environment. When enqueuing a job with GoodJob's inline adapter, the job will be executed immediately on the current thread; unhandled exceptions will be raised.
|
|
1507
1509
|
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
To opt into this behavior immediately set: `config.good_job.inline_execution_respects_schedule = true`
|
|
1510
|
+
The inline adapter respects scheduled jobs: jobs scheduled for the future are enqueued in the database rather than executed immediately.
|
|
1511
1511
|
|
|
1512
1512
|
To perform jobs inline at any time, use `GoodJob.perform_inline`. For example, using time helpers within an integration test:
|
|
1513
1513
|
|
|
@@ -225,10 +225,10 @@ module GoodJob
|
|
|
225
225
|
unless respond_to?(:adapter_class)
|
|
226
226
|
define_singleton_method(:adapter_class) do
|
|
227
227
|
@_adapter_class ||= begin
|
|
228
|
-
|
|
228
|
+
klass = self
|
|
229
229
|
proxy = Object.new
|
|
230
|
-
proxy.define_singleton_method(:quote_table_name) { |name|
|
|
231
|
-
proxy.define_singleton_method(:quote_column_name) { |name|
|
|
230
|
+
proxy.define_singleton_method(:quote_table_name) { |name| klass.connection_pool.with_connection { |c| c.quote_table_name(name) } }
|
|
231
|
+
proxy.define_singleton_method(:quote_column_name) { |name| klass.connection_pool.with_connection { |c| c.quote_column_name(name) } }
|
|
232
232
|
proxy
|
|
233
233
|
end
|
|
234
234
|
end
|
|
@@ -197,6 +197,12 @@ module GoodJob
|
|
|
197
197
|
new _record: BatchRecord.find(id)
|
|
198
198
|
end
|
|
199
199
|
|
|
200
|
+
# Required by GlobalID::Locator.fetch/locate_many, which query with
|
|
201
|
+
# `ignore_missing: true` and thus call `.where(id: ids)` instead of `.find(id)`.
|
|
202
|
+
def self.where(id:)
|
|
203
|
+
BatchRecord.where(id: id).map { |record| new(_record: record) }
|
|
204
|
+
end
|
|
205
|
+
|
|
200
206
|
# Helper method to enqueue jobs and assign them to a batch
|
|
201
207
|
def self.within_thread(batch_id: nil, batch_callback_id: nil)
|
|
202
208
|
original_batch_id = current_batch_id
|
data/app/models/good_job/job.rb
CHANGED
|
@@ -327,8 +327,11 @@ module GoodJob
|
|
|
327
327
|
new(**enqueue_args(active_job, scheduled_at: scheduled_at))
|
|
328
328
|
end
|
|
329
329
|
|
|
330
|
-
# Construct arguments for GoodJob::
|
|
330
|
+
# Construct arguments for GoodJob::Job from an ActiveJob instance.
|
|
331
331
|
def self.enqueue_args(active_job, scheduled_at: nil)
|
|
332
|
+
reenqueued_current_job = CurrentThread.active_job_id && CurrentThread.active_job_id == active_job.job_id
|
|
333
|
+
current_job = CurrentThread.job
|
|
334
|
+
|
|
332
335
|
execution_args = {
|
|
333
336
|
id: active_job.job_id,
|
|
334
337
|
active_job_id: active_job.job_id,
|
|
@@ -336,15 +339,16 @@ module GoodJob
|
|
|
336
339
|
queue_name: active_job.queue_name.presence || DEFAULT_QUEUE_NAME,
|
|
337
340
|
priority: active_job.priority || DEFAULT_PRIORITY,
|
|
338
341
|
serialized_params: active_job.serialize,
|
|
339
|
-
created_at: Time.current,
|
|
340
342
|
}
|
|
341
343
|
|
|
344
|
+
now = Time.current
|
|
345
|
+
execution_args[:created_at] = now if !reenqueued_current_job || GoodJob.configuration.dequeue_query_sort == :created_at
|
|
342
346
|
execution_args[:scheduled_at] = if scheduled_at
|
|
343
347
|
scheduled_at
|
|
344
348
|
elsif active_job.scheduled_at
|
|
345
349
|
Time.zone.at(active_job.scheduled_at)
|
|
346
350
|
else
|
|
347
|
-
|
|
351
|
+
now
|
|
348
352
|
end
|
|
349
353
|
|
|
350
354
|
execution_args[:concurrency_key] = active_job.good_job_concurrency_key if active_job.respond_to?(:good_job_concurrency_key)
|
|
@@ -356,9 +360,6 @@ module GoodJob
|
|
|
356
360
|
execution_args[:labels] = labels
|
|
357
361
|
end
|
|
358
362
|
|
|
359
|
-
reenqueued_current_job = CurrentThread.active_job_id && CurrentThread.active_job_id == active_job.job_id
|
|
360
|
-
current_job = CurrentThread.job
|
|
361
|
-
|
|
362
363
|
if reenqueued_current_job
|
|
363
364
|
execution_args[:batch_id] = current_job.batch_id
|
|
364
365
|
execution_args[:batch_callback_id] = current_job.batch_callback_id
|
|
@@ -177,10 +177,6 @@ module GoodJob
|
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
-
def inline_execution_respects_schedule?
|
|
181
|
-
!!rails_config[:inline_execution_respects_schedule]
|
|
182
|
-
end
|
|
183
|
-
|
|
184
180
|
# The maximum number of future-scheduled jobs to store in memory.
|
|
185
181
|
# Storing future-scheduled jobs in memory reduces execution latency
|
|
186
182
|
# at the cost of increased memory usage. 10,000 stored jobs = ~20MB.
|
|
@@ -439,6 +435,7 @@ module GoodJob
|
|
|
439
435
|
Rails.env.development?
|
|
440
436
|
end
|
|
441
437
|
|
|
438
|
+
# TODO: Remove :created_at and this option entirely in the next major version; :scheduled_at will become the only behavior.
|
|
442
439
|
def dequeue_query_sort
|
|
443
440
|
(options[:dequeue_query_sort] || rails_config[:dequeue_query_sort] || :created_at).to_sym
|
|
444
441
|
end
|
data/lib/good_job/version.rb
CHANGED