good_job 3.15.0 → 3.16.3
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 +270 -0
- data/README.md +33 -13
- data/app/controllers/good_job/application_controller.rb +19 -10
- data/app/controllers/good_job/batches_controller.rb +1 -0
- data/app/controllers/good_job/cron_entries_controller.rb +2 -1
- data/app/controllers/good_job/frontends_controller.rb +1 -0
- data/app/controllers/good_job/jobs_controller.rb +1 -0
- data/app/controllers/good_job/processes_controller.rb +1 -0
- data/app/filters/good_job/base_filter.rb +1 -0
- data/app/filters/good_job/batches_filter.rb +1 -0
- data/app/filters/good_job/jobs_filter.rb +1 -0
- data/app/helpers/good_job/application_helper.rb +1 -1
- data/app/models/concerns/good_job/error_events.rb +45 -0
- data/app/models/concerns/good_job/filterable.rb +1 -0
- data/app/models/{good_job → concerns/good_job}/lockable.rb +3 -0
- data/app/models/concerns/good_job/reportable.rb +1 -0
- data/app/models/good_job/active_record_parent_class.rb +9 -0
- data/app/models/good_job/base_execution.rb +21 -1
- data/app/models/good_job/base_record.rb +6 -3
- data/app/models/good_job/cron_entry.rb +1 -0
- data/app/models/good_job/discrete_execution.rb +61 -0
- data/app/models/good_job/execution.rb +162 -25
- data/app/models/good_job/execution_result.rb +17 -2
- data/app/models/good_job/i18n_config.rb +25 -0
- data/app/models/good_job/job.rb +23 -7
- data/app/models/good_job/process.rb +66 -14
- data/app/views/good_job/batches/_jobs.erb +1 -1
- data/app/views/good_job/jobs/_executions.erb +1 -1
- data/app/views/good_job/jobs/_table.erb +18 -5
- data/app/views/good_job/jobs/show.html.erb +31 -5
- data/app/views/good_job/processes/index.html.erb +6 -2
- data/app/views/good_job/shared/_navbar.erb +1 -1
- data/config/locales/de.yml +9 -1
- data/config/locales/en.yml +9 -1
- data/config/locales/es.yml +9 -1
- data/config/locales/fr.yml +71 -63
- data/config/locales/ja.yml +227 -0
- data/config/locales/nl.yml +11 -3
- data/config/locales/ru.yml +9 -1
- data/config/locales/tr.yml +227 -0
- data/config/locales/{ua.yml → uk.yml} +34 -2
- data/config/routes.rb +1 -0
- data/exe/good_job +1 -0
- data/lib/active_job/queue_adapters/good_job_adapter.rb +1 -0
- data/lib/generators/good_job/install_generator.rb +1 -0
- data/lib/generators/good_job/templates/install/migrations/create_good_jobs.rb.erb +23 -1
- data/lib/generators/good_job/templates/update/migrations/01_create_good_jobs.rb.erb +3 -1
- data/lib/generators/good_job/templates/update/migrations/02_create_good_job_settings.rb.erb +1 -0
- data/lib/generators/good_job/templates/update/migrations/03_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb.erb +1 -0
- data/lib/generators/good_job/templates/update/migrations/04_create_good_job_batches.rb.erb +1 -0
- data/lib/generators/good_job/templates/update/migrations/05_create_good_job_executions.rb.erb +33 -0
- data/lib/generators/good_job/templates/update/migrations/06_create_good_jobs_error_event.rb.erb +16 -0
- data/lib/generators/good_job/update_generator.rb +1 -0
- data/lib/good_job/active_job_extensions/batches.rb +1 -0
- data/lib/good_job/active_job_extensions/concurrency.rb +2 -1
- data/lib/good_job/active_job_extensions/interrupt_errors.rb +1 -0
- data/lib/good_job/active_job_extensions/notify_options.rb +1 -0
- data/lib/good_job/adapter.rb +22 -8
- data/lib/good_job/assignable_connection.rb +1 -0
- data/lib/good_job/bulk.rb +1 -0
- data/lib/good_job/capsule.rb +22 -14
- data/lib/good_job/cleanup_tracker.rb +2 -1
- data/lib/good_job/cli.rb +2 -1
- data/lib/good_job/configuration.rb +13 -6
- data/lib/good_job/cron_manager.rb +3 -3
- data/lib/good_job/current_thread.rb +15 -0
- data/lib/good_job/daemon.rb +1 -0
- data/lib/good_job/dependencies.rb +5 -26
- data/lib/good_job/engine.rb +20 -12
- data/lib/good_job/interrupt_error.rb +1 -0
- data/lib/good_job/job_performer.rb +1 -0
- data/lib/good_job/log_subscriber.rb +1 -0
- data/lib/good_job/metrics.rb +57 -0
- data/lib/good_job/multi_scheduler.rb +1 -0
- data/lib/good_job/notifier/{process_registration.rb → process_heartbeat.rb} +12 -1
- data/lib/good_job/notifier.rb +18 -16
- data/lib/good_job/poller.rb +3 -3
- data/lib/good_job/scheduler.rb +30 -11
- data/lib/good_job/version.rb +5 -1
- data/lib/good_job.rb +67 -12
- metadata +15 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3929d3de9d0c69de6aa34b238573dd19eabb0b6753b28a06b186cfc6972b621b
|
|
4
|
+
data.tar.gz: d927b1cc39f993f64a4b07594cb7215975e02d55cb212b420122b2c672d5f2d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34ac854233932322ad76eaea4d41879b9d97c08a204b6f689affedbe861b86bc5c83b6c02dd1132c267f7f9129d4e0ace042e9299f4fe522fdf9d590b6c0cf33
|
|
7
|
+
data.tar.gz: a8007ea55894eb72494935dff5269d1e54d157eab334b823769884cc3d83d1a37be3d9cb44e603ba5a132cb3993ba8dd8e306c4d3974f9a2bf4dc2603add5706
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,275 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v3.16.3](https://github.com/bensheldon/good_job/tree/v3.16.3) (2023-07-18)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.16.2...v3.16.3)
|
|
6
|
+
|
|
7
|
+
**Fixed bugs:**
|
|
8
|
+
|
|
9
|
+
- Fix bulk enqueue for unmigrated 'error\_event'; add `GoodJob.migrated?` check method; use custom enum implementation [\#1011](https://github.com/bensheldon/good_job/pull/1011) ([bensheldon](https://github.com/bensheldon))
|
|
10
|
+
|
|
11
|
+
**Closed issues:**
|
|
12
|
+
|
|
13
|
+
- GoodJob::Bulk.enqueue not handling missing migrations [\#1010](https://github.com/bensheldon/good_job/issues/1010)
|
|
14
|
+
|
|
15
|
+
**Merged pull requests:**
|
|
16
|
+
|
|
17
|
+
- Move shared `BaseExecution` concerns into the base class. [\#1009](https://github.com/bensheldon/good_job/pull/1009) ([dixpac](https://github.com/dixpac))
|
|
18
|
+
|
|
19
|
+
## [v3.16.2](https://github.com/bensheldon/good_job/tree/v3.16.2) (2023-07-13)
|
|
20
|
+
|
|
21
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.16.1...v3.16.2)
|
|
22
|
+
|
|
23
|
+
**Closed issues:**
|
|
24
|
+
|
|
25
|
+
- Support for customized job display name [\#956](https://github.com/bensheldon/good_job/issues/956)
|
|
26
|
+
|
|
27
|
+
**Merged pull requests:**
|
|
28
|
+
|
|
29
|
+
- Add `GoodJob::Job#display_name` to allow customizing dashboard job display [\#1008](https://github.com/bensheldon/good_job/pull/1008) ([paul](https://github.com/paul))
|
|
30
|
+
|
|
31
|
+
## [v3.16.1](https://github.com/bensheldon/good_job/tree/v3.16.1) (2023-07-11)
|
|
32
|
+
|
|
33
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.16.0...v3.16.1)
|
|
34
|
+
|
|
35
|
+
**Fixed bugs:**
|
|
36
|
+
|
|
37
|
+
- Wrap Notifier's `refresh_process` with Rails executor [\#1007](https://github.com/bensheldon/good_job/pull/1007) ([bensheldon](https://github.com/bensheldon))
|
|
38
|
+
|
|
39
|
+
**Closed issues:**
|
|
40
|
+
|
|
41
|
+
- uninitialized constant GoodJob::Process [\#1006](https://github.com/bensheldon/good_job/issues/1006)
|
|
42
|
+
|
|
43
|
+
## [v3.16.0](https://github.com/bensheldon/good_job/tree/v3.16.0) (2023-07-10)
|
|
44
|
+
|
|
45
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.14...v3.16.0)
|
|
46
|
+
|
|
47
|
+
**Implemented enhancements:**
|
|
48
|
+
|
|
49
|
+
- Add `GoodJob.configure_active_record` as alternative to `GoodJob.active_record_parent_class` [\#1004](https://github.com/bensheldon/good_job/pull/1004) ([bensheldon](https://github.com/bensheldon))
|
|
50
|
+
- Configure `dashboard_default_locale` using custom subclass of `I18n::Config` to isolate I18n configuration from parent application [\#1001](https://github.com/bensheldon/good_job/pull/1001) ([bensheldon](https://github.com/bensheldon))
|
|
51
|
+
- Create `error_event` column to track the context of an error \(discarded, retried, retry\_stopped, etc\) [\#995](https://github.com/bensheldon/good_job/pull/995) ([bensheldon](https://github.com/bensheldon))
|
|
52
|
+
- Added metrics to Scheduler and track in Process state [\#984](https://github.com/bensheldon/good_job/pull/984) ([AndersGM](https://github.com/AndersGM))
|
|
53
|
+
|
|
54
|
+
**Fixed bugs:**
|
|
55
|
+
|
|
56
|
+
- Use Concurrent::Array for class `instances` to avoid JRuby synchronization errors [\#1002](https://github.com/bensheldon/good_job/pull/1002) ([bensheldon](https://github.com/bensheldon))
|
|
57
|
+
- Add test to assert enqueuing behavior within transactions [\#998](https://github.com/bensheldon/good_job/pull/998) ([bensheldon](https://github.com/bensheldon))
|
|
58
|
+
- Fix Ukrainian language code [\#996](https://github.com/bensheldon/good_job/pull/996) ([bensheldon](https://github.com/bensheldon))
|
|
59
|
+
|
|
60
|
+
**Closed issues:**
|
|
61
|
+
|
|
62
|
+
- Is `pgcrypto` necessary? [\#805](https://github.com/bensheldon/good_job/issues/805)
|
|
63
|
+
- Integrate Sorbet type checking [\#404](https://github.com/bensheldon/good_job/issues/404)
|
|
64
|
+
|
|
65
|
+
**Merged pull requests:**
|
|
66
|
+
|
|
67
|
+
- Unify `frozen_string_literal` comment style [\#1003](https://github.com/bensheldon/good_job/pull/1003) ([dixpac](https://github.com/dixpac))
|
|
68
|
+
- Add more execution mode details and caveats to Readme Set Up section [\#997](https://github.com/bensheldon/good_job/pull/997) ([bensheldon](https://github.com/bensheldon))
|
|
69
|
+
- Add note in migrations that `pgcrypto` extension isn't necessary in PG 13+ [\#837](https://github.com/bensheldon/good_job/pull/837) ([bensheldon](https://github.com/bensheldon))
|
|
70
|
+
- Add Sorbet to linter [\#760](https://github.com/bensheldon/good_job/pull/760) ([sam1el](https://github.com/sam1el))
|
|
71
|
+
|
|
72
|
+
## [v3.15.14](https://github.com/bensheldon/good_job/tree/v3.15.14) (2023-07-03)
|
|
73
|
+
|
|
74
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.13...v3.15.14)
|
|
75
|
+
|
|
76
|
+
**Implemented enhancements:**
|
|
77
|
+
|
|
78
|
+
- Add Process heartbeat that is updated inside of Notifier [\#977](https://github.com/bensheldon/good_job/pull/977) ([bensheldon](https://github.com/bensheldon))
|
|
79
|
+
|
|
80
|
+
**Fixed bugs:**
|
|
81
|
+
|
|
82
|
+
- Dashboard error when trying to display 0 running/queued/retried jobs due to missing 'zero' translation [\#990](https://github.com/bensheldon/good_job/issues/990)
|
|
83
|
+
- Add explicit namespace back to `GoodJob::DiscreteExecution` [\#983](https://github.com/bensheldon/good_job/pull/983) ([bensheldon](https://github.com/bensheldon))
|
|
84
|
+
|
|
85
|
+
**Closed issues:**
|
|
86
|
+
|
|
87
|
+
- Persisting ActiveSupport::CurrentAttributes [\#981](https://github.com/bensheldon/good_job/issues/981)
|
|
88
|
+
- uninitialized constant DiscreteExecution [\#962](https://github.com/bensheldon/good_job/issues/962)
|
|
89
|
+
- Hard kill resilience with execution counts [\#922](https://github.com/bensheldon/good_job/issues/922)
|
|
90
|
+
|
|
91
|
+
**Merged pull requests:**
|
|
92
|
+
|
|
93
|
+
- Bump rubocop from 1.53.0 to 1.54.0 [\#994](https://github.com/bensheldon/good_job/pull/994) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
94
|
+
- Bump rails from 7.0.5 to 7.0.6 [\#993](https://github.com/bensheldon/good_job/pull/993) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
95
|
+
- Fix CI: Lock traces version for Ruby 2.6 compatible version [\#987](https://github.com/bensheldon/good_job/pull/987) ([bensheldon](https://github.com/bensheldon))
|
|
96
|
+
- Turkish Language support [\#986](https://github.com/bensheldon/good_job/pull/986) ([SemihCag](https://github.com/SemihCag))
|
|
97
|
+
- Use generic error reporter in Readme examples [\#964](https://github.com/bensheldon/good_job/pull/964) ([shouichi](https://github.com/shouichi))
|
|
98
|
+
|
|
99
|
+
## [v3.15.13](https://github.com/bensheldon/good_job/tree/v3.15.13) (2023-06-14)
|
|
100
|
+
|
|
101
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.12...v3.15.13)
|
|
102
|
+
|
|
103
|
+
**Fixed bugs:**
|
|
104
|
+
|
|
105
|
+
- Replace uncached table\_exists? with cached table\_exists? [\#979](https://github.com/bensheldon/good_job/pull/979) ([cmcinnes-mdsol](https://github.com/cmcinnes-mdsol))
|
|
106
|
+
|
|
107
|
+
## [v3.15.12](https://github.com/bensheldon/good_job/tree/v3.15.12) (2023-06-11)
|
|
108
|
+
|
|
109
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.11...v3.15.12)
|
|
110
|
+
|
|
111
|
+
**Fixed bugs:**
|
|
112
|
+
|
|
113
|
+
- Do not allow GoodJob to automatically start after Rails initialization if previously shutdown [\#976](https://github.com/bensheldon/good_job/pull/976) ([bensheldon](https://github.com/bensheldon))
|
|
114
|
+
|
|
115
|
+
**Merged pull requests:**
|
|
116
|
+
|
|
117
|
+
- Fix Rubocop linting [\#975](https://github.com/bensheldon/good_job/pull/975) ([bensheldon](https://github.com/bensheldon))
|
|
118
|
+
- Bump capybara from 3.38.0 to 3.39.1 [\#970](https://github.com/bensheldon/good_job/pull/970) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
119
|
+
- Bump thor from 1.2.1 to 1.2.2 [\#967](https://github.com/bensheldon/good_job/pull/967) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
120
|
+
|
|
121
|
+
## [v3.15.11](https://github.com/bensheldon/good_job/tree/v3.15.11) (2023-06-06)
|
|
122
|
+
|
|
123
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.10...v3.15.11)
|
|
124
|
+
|
|
125
|
+
**Fixed bugs:**
|
|
126
|
+
|
|
127
|
+
- Fix `discrete_executions` job re-enqueueing when `retry_job` is called directly [\#973](https://github.com/bensheldon/good_job/pull/973) ([bensheldon](https://github.com/bensheldon))
|
|
128
|
+
|
|
129
|
+
**Closed issues:**
|
|
130
|
+
|
|
131
|
+
- Unclear how discrete executions should work with reenqueued jobs \(leads to broken job-iteration\) [\#972](https://github.com/bensheldon/good_job/issues/972)
|
|
132
|
+
- `build_for_enqueue` discards `scheduled_at` values for bulk-enqueued jobs [\#966](https://github.com/bensheldon/good_job/issues/966)
|
|
133
|
+
|
|
134
|
+
## [v3.15.10](https://github.com/bensheldon/good_job/tree/v3.15.10) (2023-05-22)
|
|
135
|
+
|
|
136
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.9...v3.15.10)
|
|
137
|
+
|
|
138
|
+
**Fixed bugs:**
|
|
139
|
+
|
|
140
|
+
- Ensure migration warning for `DiscreteExecution` constant is in explicit `GoodJob::` namespace [\#963](https://github.com/bensheldon/good_job/pull/963) ([bensheldon](https://github.com/bensheldon))
|
|
141
|
+
|
|
142
|
+
## [v3.15.9](https://github.com/bensheldon/good_job/tree/v3.15.9) (2023-05-21)
|
|
143
|
+
|
|
144
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.8...v3.15.9)
|
|
145
|
+
|
|
146
|
+
**Fixed bugs:**
|
|
147
|
+
|
|
148
|
+
- Fix wait and wait\_until ignored in bulk enqueue [\#960](https://github.com/bensheldon/good_job/pull/960) ([bensheldon](https://github.com/bensheldon))
|
|
149
|
+
|
|
150
|
+
**Closed issues:**
|
|
151
|
+
|
|
152
|
+
- Does Bulk enqueue respect wait? [\#959](https://github.com/bensheldon/good_job/issues/959)
|
|
153
|
+
- BaseExecution::discrete\_support? hardcodes the DiscreteExecution table\_name [\#957](https://github.com/bensheldon/good_job/issues/957)
|
|
154
|
+
|
|
155
|
+
**Merged pull requests:**
|
|
156
|
+
|
|
157
|
+
- Fix flaky jruby test to widen time-based range [\#961](https://github.com/bensheldon/good_job/pull/961) ([bensheldon](https://github.com/bensheldon))
|
|
158
|
+
- Update README.md [\#953](https://github.com/bensheldon/good_job/pull/953) ([namiwang](https://github.com/namiwang))
|
|
159
|
+
|
|
160
|
+
## [v3.15.8](https://github.com/bensheldon/good_job/tree/v3.15.8) (2023-05-19)
|
|
161
|
+
|
|
162
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.7...v3.15.8)
|
|
163
|
+
|
|
164
|
+
**Fixed bugs:**
|
|
165
|
+
|
|
166
|
+
- Fix hard-coded and duplicated table\_name [\#958](https://github.com/bensheldon/good_job/pull/958) ([gap777](https://github.com/gap777))
|
|
167
|
+
|
|
168
|
+
**Closed issues:**
|
|
169
|
+
|
|
170
|
+
- `active_job.enqueue` Performance Issue [\#939](https://github.com/bensheldon/good_job/issues/939)
|
|
171
|
+
|
|
172
|
+
**Merged pull requests:**
|
|
173
|
+
|
|
174
|
+
- Bump rubocop from 1.46.0 to 1.50.2 [\#949](https://github.com/bensheldon/good_job/pull/949) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
175
|
+
- Bump rubocop-rails from 2.18.0 to 2.19.1 [\#947](https://github.com/bensheldon/good_job/pull/947) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
176
|
+
|
|
177
|
+
## [v3.15.7](https://github.com/bensheldon/good_job/tree/v3.15.7) (2023-04-30)
|
|
178
|
+
|
|
179
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.6...v3.15.7)
|
|
180
|
+
|
|
181
|
+
**Fixed bugs:**
|
|
182
|
+
|
|
183
|
+
- Fix Lockable's `SELECT 1 AS one` queries missing `LIMIT 1` [\#946](https://github.com/bensheldon/good_job/pull/946) ([bensheldon](https://github.com/bensheldon))
|
|
184
|
+
|
|
185
|
+
**Closed issues:**
|
|
186
|
+
|
|
187
|
+
- Issue with performing jobs that use ActionMailer::Parameterized [\#944](https://github.com/bensheldon/good_job/issues/944)
|
|
188
|
+
- Deprecation warning on the deprecation warning [\#943](https://github.com/bensheldon/good_job/issues/943)
|
|
189
|
+
|
|
190
|
+
**Merged pull requests:**
|
|
191
|
+
|
|
192
|
+
- Replace class usage of ActiveSupport::Deprecator with gem-specific instance [\#945](https://github.com/bensheldon/good_job/pull/945) ([bensheldon](https://github.com/bensheldon))
|
|
193
|
+
|
|
194
|
+
## [v3.15.6](https://github.com/bensheldon/good_job/tree/v3.15.6) (2023-04-24)
|
|
195
|
+
|
|
196
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.5...v3.15.6)
|
|
197
|
+
|
|
198
|
+
**Merged pull requests:**
|
|
199
|
+
|
|
200
|
+
- Refine french translations [\#936](https://github.com/bensheldon/good_job/pull/936) ([francois-ferrandis](https://github.com/francois-ferrandis))
|
|
201
|
+
- feat: locales for ja [\#935](https://github.com/bensheldon/good_job/pull/935) ([aki77](https://github.com/aki77))
|
|
202
|
+
|
|
203
|
+
## [v3.15.5](https://github.com/bensheldon/good_job/tree/v3.15.5) (2023-04-24)
|
|
204
|
+
|
|
205
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.4...v3.15.5)
|
|
206
|
+
|
|
207
|
+
**Fixed bugs:**
|
|
208
|
+
|
|
209
|
+
- Fix `GoodJob.cleanup_preserved_jobs` to add missing guard for unmigrated discrete executions [\#938](https://github.com/bensheldon/good_job/pull/938) ([bensheldon](https://github.com/bensheldon))
|
|
210
|
+
|
|
211
|
+
**Closed issues:**
|
|
212
|
+
|
|
213
|
+
- Update to 3.15.4 breaks cleanup\_preserved\_jobs [\#937](https://github.com/bensheldon/good_job/issues/937)
|
|
214
|
+
|
|
215
|
+
## [v3.15.4](https://github.com/bensheldon/good_job/tree/v3.15.4) (2023-04-22)
|
|
216
|
+
|
|
217
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.3...v3.15.4)
|
|
218
|
+
|
|
219
|
+
**Merged pull requests:**
|
|
220
|
+
|
|
221
|
+
- Create "discrete" `good_job_executions` table to separate Job records from Execution records and have a 1-to-1 correspondence between `good_jobs` records and Active Job jobs [\#928](https://github.com/bensheldon/good_job/pull/928) ([bensheldon](https://github.com/bensheldon))
|
|
222
|
+
|
|
223
|
+
## [v3.15.3](https://github.com/bensheldon/good_job/tree/v3.15.3) (2023-04-22)
|
|
224
|
+
|
|
225
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.2...v3.15.3)
|
|
226
|
+
|
|
227
|
+
**Merged pull requests:**
|
|
228
|
+
|
|
229
|
+
- Eagerly autoload `ActiveJob::Base`; clean up framework deferred-loading logic to use nested `on_load` blocks [\#931](https://github.com/bensheldon/good_job/pull/931) ([bensheldon](https://github.com/bensheldon))
|
|
230
|
+
|
|
231
|
+
## [v3.15.2](https://github.com/bensheldon/good_job/tree/v3.15.2) (2023-04-19)
|
|
232
|
+
|
|
233
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.1...v3.15.2)
|
|
234
|
+
|
|
235
|
+
**Closed issues:**
|
|
236
|
+
|
|
237
|
+
- Cleaning up preserved jobs giving me timeout [\#933](https://github.com/bensheldon/good_job/issues/933)
|
|
238
|
+
- uninitialized constant GoodJob::ActiveJobJob \(NameError\) [\#932](https://github.com/bensheldon/good_job/issues/932)
|
|
239
|
+
|
|
240
|
+
**Merged pull requests:**
|
|
241
|
+
|
|
242
|
+
- Use batched queries in `GoodJob::self.cleanup_preserved_jobs` [\#934](https://github.com/bensheldon/good_job/pull/934) ([bensheldon](https://github.com/bensheldon))
|
|
243
|
+
- Bump nokogiri from 1.14.2 to 1.14.3 [\#926](https://github.com/bensheldon/good_job/pull/926) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
244
|
+
|
|
245
|
+
## [v3.15.1](https://github.com/bensheldon/good_job/tree/v3.15.1) (2023-04-17)
|
|
246
|
+
|
|
247
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.15.0...v3.15.1)
|
|
248
|
+
|
|
249
|
+
**Implemented enhancements:**
|
|
250
|
+
|
|
251
|
+
- Support for Batches? [\#417](https://github.com/bensheldon/good_job/issues/417)
|
|
252
|
+
|
|
253
|
+
**Fixed bugs:**
|
|
254
|
+
|
|
255
|
+
- Fix setting of locale via routes `mount ... defaults: { locale: :en }` [\#923](https://github.com/bensheldon/good_job/pull/923) ([bensheldon](https://github.com/bensheldon))
|
|
256
|
+
- Set `successfully_enqueued?` when using `perform_all_later` [\#917](https://github.com/bensheldon/good_job/pull/917) ([bensheldon](https://github.com/bensheldon))
|
|
257
|
+
|
|
258
|
+
**Closed issues:**
|
|
259
|
+
|
|
260
|
+
- GoodJob has pending database migrations after v2 -\> v3 [\#920](https://github.com/bensheldon/good_job/issues/920)
|
|
261
|
+
- Batch docs in README suggest `Batch#add` is a class method, but it's not [\#912](https://github.com/bensheldon/good_job/issues/912)
|
|
262
|
+
- How do I clear queue during tests? [\#887](https://github.com/bensheldon/good_job/issues/887)
|
|
263
|
+
- Implement batch functionality [\#691](https://github.com/bensheldon/good_job/issues/691)
|
|
264
|
+
|
|
265
|
+
**Merged pull requests:**
|
|
266
|
+
|
|
267
|
+
- 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))
|
|
268
|
+
- 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))
|
|
269
|
+
- Fix lint: missing fr and nl translations; readme whitespace [\#914](https://github.com/bensheldon/good_job/pull/914) ([bensheldon](https://github.com/bensheldon))
|
|
270
|
+
- 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))
|
|
271
|
+
- 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))
|
|
272
|
+
|
|
3
273
|
## [v3.15.0](https://github.com/bensheldon/good_job/tree/v3.15.0) (2023-04-02)
|
|
4
274
|
|
|
5
275
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.14.2...v3.15.0)
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GoodJob
|
|
2
2
|
|
|
3
3
|
[](https://rubygems.org/gems/good_job)
|
|
4
|
-
[](https://github.com/bensheldon/good_job/actions/workflows/test.yml?query=branch%3Amain)
|
|
5
5
|
[](https://www.ruby-toolbox.com/projects/good_job)
|
|
6
6
|
|
|
7
7
|
GoodJob is a multithreaded, Postgres-based, ActiveJob backend for Ruby on Rails.
|
|
@@ -121,8 +121,13 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
|
|
|
121
121
|
YourJob.set(queue: :some_queue, wait: 5.minutes, priority: 10).perform_later
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
1. In development, GoodJob executes jobs
|
|
125
|
-
|
|
124
|
+
1. **In Rails' development environment**, by default, GoodJob's Adapter executes jobs `async` in a background thread pool in `rails server`.
|
|
125
|
+
- Because of Rails deferred autoloading, jobs enqueued via the `rails console` may not begin executing on a separate server process until the Rails application is fully initialized by loading a web page once.
|
|
126
|
+
- Remember, only Active Job's `perform_later` sends jobs to the queue adapter; Active Job's `perform_now` executes the job immediately and does not invoke the queue adapter. GoodJob is not involved in `perform_now` jobs.
|
|
127
|
+
1. **In Rails' test environment**, by default, GoodJob's Adapter executes jobs `inline` immediately in the current thread.
|
|
128
|
+
- Future-scheduled jobs can be executed with `GoodJob.perform_inline` using using a tool like Timecop or `ActiveSupport::Testing::TimeHelpers`.
|
|
129
|
+
- Note that Active Job's TestAdapter, which powers test helpers (e.g. `assert_enqueued_with`), may override GoodJob's Adapter in [some configurations](https://github.com/rails/rails/issues/37270).
|
|
130
|
+
1. **In Rails' production environment**, by default, GoodJob's Adapter enqueues jobs in `external` mode to be executed by a separate execution process:
|
|
126
131
|
- By default, GoodJob separates job enqueuing from job execution so that jobs can be scaled independently of the web server. Use the GoodJob command-line tool to execute jobs:
|
|
127
132
|
|
|
128
133
|
```bash
|
|
@@ -231,7 +236,7 @@ Rails.application.configure do
|
|
|
231
236
|
# Configure options individually...
|
|
232
237
|
config.good_job.preserve_job_records = true
|
|
233
238
|
config.good_job.retry_on_unhandled_error = false
|
|
234
|
-
config.good_job.on_thread_error = -> (exception) {
|
|
239
|
+
config.good_job.on_thread_error = -> (exception) { Rails.error.report(exception) }
|
|
235
240
|
config.good_job.execution_mode = :async
|
|
236
241
|
config.good_job.queues = '*'
|
|
237
242
|
config.good_job.max_threads = 5
|
|
@@ -239,12 +244,13 @@ Rails.application.configure do
|
|
|
239
244
|
config.good_job.shutdown_timeout = 25 # seconds
|
|
240
245
|
config.good_job.enable_cron = true
|
|
241
246
|
config.good_job.cron = { example: { cron: '0 * * * *', class: 'ExampleJob' } }
|
|
247
|
+
config.good_job.dashboard_default_locale = :en
|
|
242
248
|
|
|
243
249
|
# ...or all at once.
|
|
244
250
|
config.good_job = {
|
|
245
251
|
preserve_job_records: true,
|
|
246
252
|
retry_on_unhandled_error: false,
|
|
247
|
-
on_thread_error: -> (exception) {
|
|
253
|
+
on_thread_error: -> (exception) { Rails.error.report(exception) },
|
|
248
254
|
execution_mode: :async,
|
|
249
255
|
queues: '*',
|
|
250
256
|
max_threads: 5,
|
|
@@ -257,6 +263,7 @@ Rails.application.configure do
|
|
|
257
263
|
class: 'ExampleJob'
|
|
258
264
|
},
|
|
259
265
|
},
|
|
266
|
+
dashboard_default_locale: :en,
|
|
260
267
|
}
|
|
261
268
|
end
|
|
262
269
|
```
|
|
@@ -287,7 +294,7 @@ Available configuration options are:
|
|
|
287
294
|
- `on_thread_error` (proc, lambda, or callable) will be called when there is an Exception. It can be useful for logging errors to bug tracking services, like Sentry or Airbrake. Example:
|
|
288
295
|
|
|
289
296
|
```ruby
|
|
290
|
-
config.good_job.on_thread_error = -> (exception) {
|
|
297
|
+
config.good_job.on_thread_error = -> (exception) { Rails.error.report(exception) }
|
|
291
298
|
```
|
|
292
299
|
|
|
293
300
|
By default, GoodJob configures the following execution modes per environment:
|
|
@@ -311,7 +318,17 @@ config.good_job.execution_mode = :external
|
|
|
311
318
|
|
|
312
319
|
Good Job’s general behavior can also be configured via attributes directly on the `GoodJob` module:
|
|
313
320
|
|
|
314
|
-
- **`GoodJob.
|
|
321
|
+
- **`GoodJob.configure_active_record { ... }`** Inject Active Record configuration into GoodJob's base model, for example, when using [multiple databases with ActiveRecord](https://guides.rubyonrails.org/active_record_multiple_databases.html) or when other custom configuration is necessary for the ActiveRecord model to connect to the Postgres database. Example:
|
|
322
|
+
|
|
323
|
+
```ruby
|
|
324
|
+
# config/initializers/good_job.rb
|
|
325
|
+
GoodJob.configure_active_record do
|
|
326
|
+
connects_to database: :special_database
|
|
327
|
+
self.table_name_prefix = "special_application_"
|
|
328
|
+
end
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
- **`GoodJob.active_record_parent_class`** (string) Alternatively, modify the ActiveRecord parent class inherited by GoodJob's Active Record model `GoodJob::Job` (defaults to `"ActiveRecord::Base"`). Configure this _The value must be a String to avoid premature initialization of ActiveRecord._
|
|
315
332
|
|
|
316
333
|
You’ll generally want to configure these in `config/initializers/good_job.rb`, like so:
|
|
317
334
|
|
|
@@ -472,7 +489,7 @@ config.good_job.enable_cron = ENV['DYNO'] == 'worker.1' # or `true` or via $GOOD
|
|
|
472
489
|
|
|
473
490
|
# Configure cron with a hash that has a unique key for each recurring job
|
|
474
491
|
config.good_job.cron = {
|
|
475
|
-
# Every 15 minutes, enqueue `ExampleJob.set(priority: -10).perform_later(42, name: "Alice")`
|
|
492
|
+
# Every 15 minutes, enqueue `ExampleJob.set(priority: -10).perform_later(42, "life", name: "Alice")`
|
|
476
493
|
frequent_task: { # each recurring job must have a unique key
|
|
477
494
|
cron: "*/15 * * * *", # cron-style scheduling format by fugit gem
|
|
478
495
|
class: "ExampleJob", # reference the Job class with a string
|
|
@@ -537,6 +554,7 @@ Batches track a set of jobs, and enqueue an optional callback job when all of th
|
|
|
537
554
|
- Jobs can be added to an existing batch. Jobs in a batch are enqueued and performed immediately/asynchronously. The final callback job will not be enqueued until `GoodJob::Batch#enqueue` is called.
|
|
538
555
|
|
|
539
556
|
```ruby
|
|
557
|
+
batch = GoodJob::Batch.new
|
|
540
558
|
batch = GoodJob::Batch.add do
|
|
541
559
|
10.times { MyJob.perform_later }
|
|
542
560
|
end
|
|
@@ -685,7 +703,9 @@ GoodJob follows semantic versioning, though updates may be encouraged through de
|
|
|
685
703
|
|
|
686
704
|
#### Upgrading minor versions
|
|
687
705
|
|
|
688
|
-
Upgrading between minor versions (e.g. v1.4 to v1.5) should not introduce breaking changes, but can introduce new deprecation warnings and database migration
|
|
706
|
+
Upgrading between minor versions (e.g. v1.4 to v1.5) should not introduce breaking changes, but can introduce new deprecation warnings and database migration warnings.
|
|
707
|
+
|
|
708
|
+
Database migrations introduced in minor releases are _not required_ to be applied until the next major release. If you would like apply newly introduced migrations immediately, assert `GoodJob.migrated?` in your application's test suite.
|
|
689
709
|
|
|
690
710
|
To perform upgrades to the GoodJob database tables:
|
|
691
711
|
|
|
@@ -759,7 +779,7 @@ If errors do reach GoodJob, you can assign a callable to `GoodJob.on_thread_erro
|
|
|
759
779
|
|
|
760
780
|
```ruby
|
|
761
781
|
# config/initializers/good_job.rb
|
|
762
|
-
GoodJob.on_thread_error = -> (exception) {
|
|
782
|
+
GoodJob.on_thread_error = -> (exception) { Rails.error.report(exception) }
|
|
763
783
|
```
|
|
764
784
|
|
|
765
785
|
#### Retries
|
|
@@ -793,13 +813,13 @@ class ApplicationJob < ActiveJob::Base
|
|
|
793
813
|
retry_on StandardError, wait: :exponentially_longer, attempts: Float::INFINITY
|
|
794
814
|
|
|
795
815
|
retry_on SpecialError, attempts: 5 do |_job, exception|
|
|
796
|
-
|
|
816
|
+
Rails.error.report(exception)
|
|
797
817
|
end
|
|
798
818
|
|
|
799
819
|
around_perform do |_job, block|
|
|
800
820
|
block.call
|
|
801
821
|
rescue StandardError => e
|
|
802
|
-
|
|
822
|
+
Rails.error.report(e)
|
|
803
823
|
raise
|
|
804
824
|
end
|
|
805
825
|
# ...
|
|
@@ -822,7 +842,7 @@ ActionMailer::MailDeliveryJob.retry_on StandardError, wait: :exponentially_longe
|
|
|
822
842
|
ActionMailer::MailDeliveryJob.around_perform do |_job, block|
|
|
823
843
|
block.call
|
|
824
844
|
rescue StandardError => e
|
|
825
|
-
|
|
845
|
+
Rails.error.report(e)
|
|
826
846
|
raise
|
|
827
847
|
end
|
|
828
848
|
```
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
module GoodJob
|
|
3
4
|
class ApplicationController < ActionController::Base
|
|
4
5
|
protect_from_forgery with: :exception
|
|
5
6
|
|
|
6
|
-
around_action :
|
|
7
|
+
around_action :use_good_job_locale
|
|
7
8
|
|
|
8
9
|
content_security_policy do |policy|
|
|
9
10
|
policy.default_src(:none) if policy.default_src(*policy.default_src).blank?
|
|
@@ -30,23 +31,31 @@ module GoodJob
|
|
|
30
31
|
{ locale: I18n.locale }.merge(options)
|
|
31
32
|
end
|
|
32
33
|
|
|
33
|
-
def
|
|
34
|
+
def use_good_job_locale(&action)
|
|
35
|
+
@original_i18n_config = I18n.config
|
|
36
|
+
I18n.config = ::GoodJob::I18nConfig.new
|
|
34
37
|
I18n.with_locale(current_locale, &action)
|
|
38
|
+
ensure
|
|
39
|
+
I18n.config = @original_i18n_config
|
|
40
|
+
@original_i18n_config = nil
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def use_original_locale
|
|
44
|
+
prev_config = I18n.config
|
|
45
|
+
I18n.config = @original_i18n_config if @original_i18n_config
|
|
46
|
+
yield
|
|
47
|
+
ensure
|
|
48
|
+
I18n.config = prev_config
|
|
35
49
|
end
|
|
36
50
|
|
|
37
51
|
def current_locale
|
|
38
|
-
if
|
|
52
|
+
if request.GET['locale']
|
|
53
|
+
request.GET['locale']
|
|
54
|
+
elsif params[:locale]
|
|
39
55
|
params[:locale]
|
|
40
|
-
elsif good_job_available_locales.exclude?(I18n.default_locale) && I18n.available_locales.include?(:en)
|
|
41
|
-
:en
|
|
42
56
|
else
|
|
43
57
|
I18n.default_locale
|
|
44
58
|
end
|
|
45
59
|
end
|
|
46
|
-
|
|
47
|
-
def good_job_available_locales
|
|
48
|
-
@_good_job_available_locales ||= GoodJob::Engine.root.join("config/locales").glob("*.yml").map { |path| File.basename(path, ".yml").to_sym }.uniq
|
|
49
|
-
end
|
|
50
|
-
helper_method :good_job_available_locales
|
|
51
60
|
end
|
|
52
61
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
module GoodJob
|
|
3
4
|
class CronEntriesController < GoodJob::ApplicationController
|
|
4
5
|
before_action :check_settings_migration!, only: [:enable, :disable]
|
|
@@ -14,7 +15,7 @@ module GoodJob
|
|
|
14
15
|
|
|
15
16
|
def enqueue
|
|
16
17
|
@cron_entry = CronEntry.find(params[:cron_key])
|
|
17
|
-
@cron_entry.enqueue(Time.current)
|
|
18
|
+
use_original_locale { @cron_entry.enqueue(Time.current) }
|
|
18
19
|
redirect_back(fallback_location: cron_entries_path, notice: t(".notice"))
|
|
19
20
|
end
|
|
20
21
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
module GoodJob
|
|
3
4
|
module ApplicationHelper
|
|
4
5
|
def format_duration(sec)
|
|
@@ -63,7 +64,6 @@ module GoodJob
|
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
def translation_exists?(key, **options)
|
|
66
|
-
true if good_job_available_locales.include?(I18n.locale)
|
|
67
67
|
I18n.exists?(scope_key_by_partial(key), **options)
|
|
68
68
|
end
|
|
69
69
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GoodJob
|
|
4
|
+
# Shared methods for filtering Execution/Job records from the +good_jobs+ table.
|
|
5
|
+
module ErrorEvents
|
|
6
|
+
extend ActiveSupport::Concern
|
|
7
|
+
|
|
8
|
+
ERROR_EVENTS = [
|
|
9
|
+
ERROR_EVENT_INTERRUPTED = 'interrupted',
|
|
10
|
+
ERROR_EVENT_UNHANDLED = 'unhandled',
|
|
11
|
+
ERROR_EVENT_HANDLED = 'handled',
|
|
12
|
+
ERROR_EVENT_RETRIED = 'retried',
|
|
13
|
+
ERROR_EVENT_RETRY_STOPPED = 'retry_stopped',
|
|
14
|
+
ERROR_EVENT_DISCARDED = 'discarded',
|
|
15
|
+
].freeze
|
|
16
|
+
|
|
17
|
+
ERROR_EVENT_ENUMS = {
|
|
18
|
+
ERROR_EVENT_INTERRUPTED => 0,
|
|
19
|
+
ERROR_EVENT_UNHANDLED => 1,
|
|
20
|
+
ERROR_EVENT_HANDLED => 2,
|
|
21
|
+
ERROR_EVENT_RETRIED => 3,
|
|
22
|
+
ERROR_EVENT_RETRY_STOPPED => 4,
|
|
23
|
+
ERROR_EVENT_DISCARDED => 5,
|
|
24
|
+
}.freeze
|
|
25
|
+
|
|
26
|
+
# TODO: GoodJob v4 can make this an `enum` once migrations are guaranteed.
|
|
27
|
+
def error_event
|
|
28
|
+
return unless self.class.columns_hash['error_event']
|
|
29
|
+
|
|
30
|
+
enum = super
|
|
31
|
+
return unless enum
|
|
32
|
+
|
|
33
|
+
ERROR_EVENT_ENUMS.key(enum)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def error_event=(event)
|
|
37
|
+
return unless self.class.columns_hash['error_event']
|
|
38
|
+
|
|
39
|
+
enum = ERROR_EVENT_ENUMS[event]
|
|
40
|
+
raise(ArgumentError, "Invalid error_event: #{event}") if event && !enum
|
|
41
|
+
|
|
42
|
+
super(enum)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
module GoodJob
|
|
3
4
|
#
|
|
4
5
|
# Adds Postgres advisory locking capabilities to an ActiveRecord record.
|
|
@@ -324,6 +325,7 @@ module GoodJob
|
|
|
324
325
|
AND pg_locks.objsubid = 1
|
|
325
326
|
AND pg_locks.classid = ('x' || substr(md5($1::text), 1, 16))::bit(32)::int
|
|
326
327
|
AND pg_locks.objid = (('x' || substr(md5($2::text), 1, 16))::bit(64) << 32)::bit(32)::int
|
|
328
|
+
LIMIT 1
|
|
327
329
|
SQL
|
|
328
330
|
binds = [
|
|
329
331
|
ActiveRecord::Relation::QueryAttribute.new('key', key, ActiveRecord::Type::String.new),
|
|
@@ -351,6 +353,7 @@ module GoodJob
|
|
|
351
353
|
AND pg_locks.classid = ('x' || substr(md5($1::text), 1, 16))::bit(32)::int
|
|
352
354
|
AND pg_locks.objid = (('x' || substr(md5($2::text), 1, 16))::bit(64) << 32)::bit(32)::int
|
|
353
355
|
AND pg_locks.pid = pg_backend_pid()
|
|
356
|
+
LIMIT 1
|
|
354
357
|
SQL
|
|
355
358
|
binds = [
|
|
356
359
|
ActiveRecord::Relation::QueryAttribute.new('key', key, ActiveRecord::Type::String.new),
|