good_job 4.5.0 → 4.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/app/charts/good_job/performance_index_chart.rb +1 -1
- data/app/charts/good_job/performance_show_chart.rb +1 -1
- data/app/charts/good_job/scheduled_by_queue_chart.rb +2 -4
- data/app/models/concerns/good_job/advisory_lockable.rb +9 -1
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +2 -2
- 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: 6c4f55ae789dad6bc4920527bdb107d7bc4422cbaec192dfc036b01ada67c54c
|
4
|
+
data.tar.gz: 8757dec952a510559eae0f7bf1a3210128b72e21d6ed3d17763507b47c4628e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da3bf2a776ffca2181d2d205250e015bc138bc23a95004a65c703631d195e1891bd9eafc86733017dbc10233fb1b978615dadac4cbcb384ce9823c28f7b5e36f
|
7
|
+
data.tar.gz: a32557214eb62cc0cecb1d17750e83f074de0aef958b771c4846ff7e543432a1e9d474d0f922a241880b21beb07f96e6397bf0445f12286f169d5891cd61496c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v4.5.1](https://github.com/bensheldon/good_job/tree/v4.5.1) (2024-11-29)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.5.0...v4.5.1)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- GoodJob.cleanup\_preserved\_jobs: add :include\_discarded option [\#1550](https://github.com/bensheldon/good_job/pull/1550) ([jonleighton](https://github.com/jonleighton))
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- Fix compatibility with `rails-head` when duplicated advisory lockable column [\#1553](https://github.com/bensheldon/good_job/pull/1553) ([Earlopain](https://github.com/Earlopain))
|
14
|
+
|
15
|
+
**Closed issues:**
|
16
|
+
|
17
|
+
- `PG::AmbiguousColumn` after upgrade to 4.5.0 [\#1551](https://github.com/bensheldon/good_job/issues/1551)
|
18
|
+
|
19
|
+
**Merged pull requests:**
|
20
|
+
|
21
|
+
- Remove usage of COALESCE from dashboard chart [\#1306](https://github.com/bensheldon/good_job/pull/1306) ([bananatron](https://github.com/bananatron))
|
22
|
+
|
3
23
|
## [v4.5.0](https://github.com/bensheldon/good_job/tree/v4.5.0) (2024-11-22)
|
4
24
|
|
5
25
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.4.2...v4.5.0)
|
@@ -21,7 +21,7 @@ module GoodJob
|
|
21
21
|
table_name = GoodJob::Execution.table_name
|
22
22
|
|
23
23
|
interval_entries = BUCKET_INTERVALS.map { "interval '#{_1}'" }.join(",")
|
24
|
-
sum_query =
|
24
|
+
sum_query = <<~SQL.squish
|
25
25
|
SELECT
|
26
26
|
WIDTH_BUCKET(duration, ARRAY[#{interval_entries}]) as bucket_index,
|
27
27
|
COUNT(WIDTH_BUCKET(duration, ARRAY[#{interval_entries}])) AS count
|
@@ -8,9 +8,7 @@ module GoodJob
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def data
|
11
|
-
|
12
|
-
|
13
|
-
count_query = Arel.sql(GoodJob::Job.pg_or_jdbc_query(<<~SQL.squish))
|
11
|
+
count_query = <<~SQL.squish
|
14
12
|
SELECT *
|
15
13
|
FROM generate_series(
|
16
14
|
date_trunc('hour', $1::timestamp),
|
@@ -23,7 +21,7 @@ module GoodJob
|
|
23
21
|
queue_name,
|
24
22
|
count(*) AS count
|
25
23
|
FROM (
|
26
|
-
#{@filter.filtered_query.except(:select, :order).select(
|
24
|
+
#{@filter.filtered_query.except(:select, :order).select(:queue_name, :scheduled_at).to_sql}
|
27
25
|
) sources
|
28
26
|
GROUP BY date_trunc('hour', scheduled_at), queue_name
|
29
27
|
) sources ON sources.scheduled_at = timestamp
|
@@ -41,8 +41,16 @@ module GoodJob
|
|
41
41
|
scope :advisory_lock, (lambda do |column: _advisory_lockable_column, function: advisory_lockable_function, select_limit: nil|
|
42
42
|
original_query = self
|
43
43
|
|
44
|
+
primary_key_for_select = primary_key.to_sym
|
45
|
+
column_for_select = column.to_sym
|
46
|
+
|
44
47
|
cte_table = Arel::Table.new(:rows)
|
45
|
-
cte_query = original_query.
|
48
|
+
cte_query = original_query.except(:limit)
|
49
|
+
cte_query = if primary_key_for_select == column_for_select
|
50
|
+
cte_query.select(primary_key_for_select)
|
51
|
+
else
|
52
|
+
cte_query.select(primary_key_for_select, column_for_select)
|
53
|
+
end
|
46
54
|
cte_query = cte_query.limit(select_limit) if select_limit
|
47
55
|
cte_type = supports_cte_materialization_specifiers? ? :MATERIALIZED : :""
|
48
56
|
composed_cte = Arel::Nodes::As.new(cte_table, Arel::Nodes::UnaryOperation.new(cte_type, cte_query.arel))
|
data/lib/good_job/version.rb
CHANGED
data/lib/good_job.rb
CHANGED
@@ -203,11 +203,11 @@ module GoodJob
|
|
203
203
|
# If you are preserving job records this way, use this method regularly to
|
204
204
|
# destroy old records and preserve space in your database.
|
205
205
|
# @param older_than [nil,Numeric,ActiveSupport::Duration] Jobs older than this will be destroyed (default: +86400+).
|
206
|
+
# @param include_discarded [Boolean] Whether or not to destroy discarded jobs (default: per +cleanup_discarded_jobs+ config option)
|
206
207
|
# @return [Integer] Number of job execution records and batches that were destroyed.
|
207
|
-
def self.cleanup_preserved_jobs(older_than: nil, in_batches_of: 1_000)
|
208
|
+
def self.cleanup_preserved_jobs(older_than: nil, in_batches_of: 1_000, include_discarded: GoodJob.configuration.cleanup_discarded_jobs?)
|
208
209
|
older_than ||= GoodJob.configuration.cleanup_preserved_jobs_before_seconds_ago
|
209
210
|
timestamp = Time.current - older_than
|
210
|
-
include_discarded = GoodJob.configuration.cleanup_discarded_jobs?
|
211
211
|
|
212
212
|
ActiveSupport::Notifications.instrument("cleanup_preserved_jobs.good_job", { older_than: older_than, timestamp: timestamp }) do |payload|
|
213
213
|
deleted_jobs_count = 0
|
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: 4.5.
|
4
|
+
version: 4.5.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: 2024-11-
|
11
|
+
date: 2024-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|