good_job 4.8.1 → 4.9.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 +4 -4
- data/CHANGELOG.md +28 -3
- data/app/models/concerns/good_job/filterable.rb +3 -3
- data/app/models/good_job/job.rb +10 -13
- data/app/views/good_job/jobs/show.html.erb +1 -1
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e647f9e6432f6972951bdf902f2de80d9cc0001ee37c9bb355fedbfaae2c0dd6
|
4
|
+
data.tar.gz: 432488ed94165af462f1702aa08cdf26b771fa2815ba5f345d7acc48fa040a42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68824597423a7149136168819e25d75f2ae427a574188352a793a0e8405eda879e032c4cfde00decab70e509c353dd3ea89752619099d1f4ddc80771ef3a7035
|
7
|
+
data.tar.gz: 90c3b1c09665ca5c2cbb3dcda3067949e69e02edb68dfea4ffb42c3a128a9603bde4ffb8ee9082fddab98651b9eea0c7096af71f5653c9af1588df7377e05d6b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v4.9.0](https://github.com/bensheldon/good_job/tree/v4.9.0) (2025-02-07)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.8.2...v4.9.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Add `GoodJob.cli?` to check if the current process was started by the `good_job` executable [\#1592](https://github.com/bensheldon/good_job/pull/1592) ([bensheldon](https://github.com/bensheldon))
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- Option to only preserve discarded/errored jobs? [\#1594](https://github.com/bensheldon/good_job/issues/1594)
|
14
|
+
- Notifier errored: TypeError: ActiveSupport::TimeWithZone can't be coerced into Integer [\#1581](https://github.com/bensheldon/good_job/issues/1581)
|
15
|
+
|
16
|
+
## [v4.8.2](https://github.com/bensheldon/good_job/tree/v4.8.2) (2025-01-26)
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.8.1...v4.8.2)
|
19
|
+
|
20
|
+
**Fixed bugs:**
|
21
|
+
|
22
|
+
- Ensure that executions are properly ordered in the dashboard [\#1588](https://github.com/bensheldon/good_job/pull/1588) ([Earlopain](https://github.com/Earlopain))
|
23
|
+
|
24
|
+
**Merged pull requests:**
|
25
|
+
|
26
|
+
- Fix passing a block to `advisory_lock` in tests [\#1587](https://github.com/bensheldon/good_job/pull/1587) ([Earlopain](https://github.com/Earlopain))
|
27
|
+
- Expect `Job#scheduled_at` to always be present; remove nil checks [\#1585](https://github.com/bensheldon/good_job/pull/1585) ([bensheldon](https://github.com/bensheldon))
|
28
|
+
|
3
29
|
## [v4.8.1](https://github.com/bensheldon/good_job/tree/v4.8.1) (2025-01-24)
|
4
30
|
|
5
31
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.8.0...v4.8.1)
|
@@ -11,7 +37,6 @@
|
|
11
37
|
**Closed issues:**
|
12
38
|
|
13
39
|
- Losing "Processes" on the dashboard [\#1582](https://github.com/bensheldon/good_job/issues/1582)
|
14
|
-
- Notifier errored: TypeError: ActiveSupport::TimeWithZone can't be coerced into Integer [\#1581](https://github.com/bensheldon/good_job/issues/1581)
|
15
40
|
- Ability to pause queues [\#1574](https://github.com/bensheldon/good_job/issues/1574)
|
16
41
|
|
17
42
|
## [v4.8.0](https://github.com/bensheldon/good_job/tree/v4.8.0) (2025-01-22)
|
@@ -3042,7 +3067,7 @@
|
|
3042
3067
|
|
3043
3068
|
**Implemented enhancements:**
|
3044
3069
|
|
3045
|
-
- Suppress backtrace of ConcurrencyExceededError [\#348](https://github.com/bensheldon/good_job/pull/348) ([
|
3070
|
+
- Suppress backtrace of ConcurrencyExceededError [\#348](https://github.com/bensheldon/good_job/pull/348) ([mikereczek](https://github.com/mikereczek))
|
3046
3071
|
|
3047
3072
|
**Closed issues:**
|
3048
3073
|
|
@@ -3428,7 +3453,7 @@
|
|
3428
3453
|
|
3429
3454
|
**Merged pull requests:**
|
3430
3455
|
|
3431
|
-
- Fix equality typo in development.rb of test\_app [\#207](https://github.com/bensheldon/good_job/pull/207) ([
|
3456
|
+
- Fix equality typo in development.rb of test\_app [\#207](https://github.com/bensheldon/good_job/pull/207) ([mikereczek](https://github.com/mikereczek))
|
3432
3457
|
|
3433
3458
|
## [v1.7.0](https://github.com/bensheldon/good_job/tree/v1.7.0) (2021-01-25)
|
3434
3459
|
|
@@ -15,11 +15,11 @@ module GoodJob
|
|
15
15
|
# Display records after this ID for keyset pagination
|
16
16
|
# @return [ActiveRecord::Relation]
|
17
17
|
scope :display_all, (lambda do |after_scheduled_at: nil, after_id: nil|
|
18
|
-
query = order(Arel.sql('
|
18
|
+
query = order(Arel.sql('scheduled_at DESC, id DESC'))
|
19
19
|
if after_scheduled_at.present? && after_id.present?
|
20
|
-
query = query.where Arel::Nodes::Grouping.new([
|
20
|
+
query = query.where Arel::Nodes::Grouping.new([arel_table["scheduled_at"], arel_table["id"]]).lt(Arel::Nodes::Grouping.new([bind_value('scheduled_at', after_scheduled_at, ActiveRecord::Type::DateTime), bind_value('id', after_id, ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Uuid)]))
|
21
21
|
elsif after_scheduled_at.present?
|
22
|
-
query = query.where
|
22
|
+
query = query.where arel_table["scheduled_at"].lt(bind_value('scheduled_at', after_scheduled_at, ActiveRecord::Type::DateTime))
|
23
23
|
end
|
24
24
|
query
|
25
25
|
end)
|
data/app/models/good_job/job.rb
CHANGED
@@ -54,11 +54,11 @@ module GoodJob
|
|
54
54
|
scope :finished_before, ->(timestamp) { where(arel_table['finished_at'].lteq(bind_value('finished_at', timestamp, ActiveRecord::Type::DateTime))) }
|
55
55
|
|
56
56
|
# First execution will run in the future
|
57
|
-
scope :scheduled, -> { where(finished_at: nil).where(
|
57
|
+
scope :scheduled, -> { where(finished_at: nil).where(arel_table['scheduled_at'].gt(bind_value('scheduled_at', Time.current, ActiveRecord::Type::DateTime))).where(params_execution_count.lt(2)) }
|
58
58
|
# Execution errored, will run in the future
|
59
|
-
scope :retried, -> { where(finished_at: nil).where(
|
59
|
+
scope :retried, -> { where(finished_at: nil).where(arel_table['scheduled_at'].gt(bind_value('scheduled_at', Time.current, ActiveRecord::Type::DateTime))).where(params_execution_count.gt(1)) }
|
60
60
|
# Immediate/Scheduled time to run has passed, waiting for an available thread run
|
61
|
-
scope :queued, -> { where(performed_at: nil, finished_at: nil).where(
|
61
|
+
scope :queued, -> { where(performed_at: nil, finished_at: nil).where(arel_table['scheduled_at'].lteq(bind_value('scheduled_at', Time.current, ActiveRecord::Type::DateTime))) }
|
62
62
|
# Advisory locked and executing
|
63
63
|
scope :running, -> { where.not(performed_at: nil).where(finished_at: nil) }
|
64
64
|
# Finished executing (succeeded or discarded)
|
@@ -94,7 +94,7 @@ module GoodJob
|
|
94
94
|
# @!method only_scheduled
|
95
95
|
# @!scope class
|
96
96
|
# @return [ActiveRecord::Relation]
|
97
|
-
scope :only_scheduled, -> { where(arel_table['scheduled_at'].lteq(bind_value('scheduled_at', DateTime.current, ActiveRecord::Type::DateTime)))
|
97
|
+
scope :only_scheduled, -> { where(arel_table['scheduled_at'].lteq(bind_value('scheduled_at', DateTime.current, ActiveRecord::Type::DateTime))) }
|
98
98
|
|
99
99
|
# Exclude jobs that are paused via queue_name or job_class.
|
100
100
|
# Only applies when enable_pauses configuration is true.
|
@@ -166,7 +166,7 @@ module GoodJob
|
|
166
166
|
# @!method schedule_ordered
|
167
167
|
# @!scope class
|
168
168
|
# @return [ActiveRecord::Relation]
|
169
|
-
scope :schedule_ordered, -> { order(
|
169
|
+
scope :schedule_ordered, -> { order(scheduled_at: :asc) }
|
170
170
|
|
171
171
|
# Get Jobs on queues that match the given queue string.
|
172
172
|
# @!method queue_string(string)
|
@@ -249,10 +249,6 @@ module GoodJob
|
|
249
249
|
Arel.sql('integer')
|
250
250
|
)
|
251
251
|
end
|
252
|
-
|
253
|
-
def coalesce_scheduled_at_created_at
|
254
|
-
arel_table.coalesce(arel_table['scheduled_at'], arel_table['created_at'])
|
255
|
-
end
|
256
252
|
end
|
257
253
|
|
258
254
|
def self.build_for_enqueue(active_job, scheduled_at: nil)
|
@@ -344,12 +340,13 @@ module GoodJob
|
|
344
340
|
|
345
341
|
after ||= Time.current
|
346
342
|
after_bind = bind_value('scheduled_at', after, ActiveRecord::Type::DateTime)
|
347
|
-
after_query = query.where(arel_table['scheduled_at'].gt(after_bind))
|
348
|
-
after_at = after_query.limit(limit).pluck(:scheduled_at
|
343
|
+
after_query = query.where(arel_table['scheduled_at'].gt(after_bind))
|
344
|
+
after_at = after_query.limit(limit).pluck(:scheduled_at)
|
349
345
|
|
350
346
|
if now_limit&.positive?
|
351
|
-
|
352
|
-
|
347
|
+
now_bind = bind_value('scheduled_at', Time.current, ActiveRecord::Type::DateTime)
|
348
|
+
now_query = query.where(arel_table['scheduled_at'].lt(now_bind))
|
349
|
+
now_at = now_query.limit(now_limit).pluck(:scheduled_at)
|
353
350
|
end
|
354
351
|
|
355
352
|
Array(now_at) + after_at
|
data/lib/good_job/version.rb
CHANGED
data/lib/good_job.rb
CHANGED
@@ -324,6 +324,12 @@ module GoodJob
|
|
324
324
|
def self.paused(type = nil)
|
325
325
|
GoodJob::Setting.paused(type)
|
326
326
|
end
|
327
|
+
|
328
|
+
# Whether this process was initialized via the GoodJob executable (`$ good_job`)
|
329
|
+
# @return [Boolean]
|
330
|
+
def self.cli?
|
331
|
+
GoodJob::CLI.within_exe?
|
332
|
+
end
|
327
333
|
end
|
328
334
|
|
329
335
|
ActiveSupport.run_load_hooks(:good_job, GoodJob)
|
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.
|
4
|
+
version: 4.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sheldon
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-02-07 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activejob
|