Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release GoodJob v4 #1394

Merged
merged 15 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [2.6, 2.7, "3.0", 3.1, 3.2, 3.3]
pg: [15]
ruby: ["3.0", 3.1, 3.2, 3.3]
pg: [16]
include:
- ruby: 3.3
pg: 11
Expand All @@ -103,6 +103,8 @@ jobs:
pg: 13
- ruby: 3.3
pg: 14
- ruby: 3.3
pg: 15
env:
PGHOST: localhost
PGUSER: good_job
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inherit_mode:
- Include

AllCops:
TargetRubyVersion: 2.6
TargetRubyVersion: 3.0
TargetRailsVersion: 6.0
DisplayCopNames: true
DisplayStyleGuide: true
Expand Down
22 changes: 21 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-07-16 00:15:42 UTC using RuboCop version 0.88.0.
# on 2024-07-07 01:28:10 UTC using RuboCop version 1.57.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/RedundantDirGlobSort:
Exclude:
- 'spec/rails_helper.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/MapCompact:
Exclude:
- 'app/controllers/good_job/jobs_controller.rb'
- 'lib/good_job/multi_scheduler.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding.
Style/ArgumentsForwarding:
Exclude:
- 'app/models/good_job/batch.rb'
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1
3.3.3
13 changes: 2 additions & 11 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
# frozen_string_literal: true

ruby_27_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
ruby_30_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0')
ruby_31_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1')
jruby = RUBY_PLATFORM.include?('java')

unless ruby_31_or_higher # https://github.com/rails/rails/issues/44090#issuecomment-1007686519
appraise "rails-6.0" do
gem "rails", "~> 6.0.0"
gem "traces", "~> 0.9.1"
gem "puma", "~> 5.6"
end

appraise "rails-6.1" do
gem "rails", "~> 6.1.0"
gem "traces", "~> 0.9.1"
gem "puma", "~> 5.6"
end
end

if ruby_27_or_higher && !ruby_31_or_higher && !jruby
# Rails HEAD requires MRI 2.7+
# activerecord-jdbcpostgresql-adapter does not have a compatible version

if ruby_30_or_higher && !ruby_31_or_higher && !jruby
appraise "rails-7.0" do
gem "rails", "~> 7.0.0"
gem "selenium-webdriver", "~> 4.0" # https://github.com/rails/rails/pull/43498
Expand Down
22 changes: 11 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ PATH
remote: .
specs:
good_job (3.99.0)
activejob (>= 6.0.0)
activerecord (>= 6.0.0)
concurrent-ruby (>= 1.0.2)
fugit (>= 1.1)
railties (>= 6.0.0)
thor (>= 0.14.1)
activejob (>= 6.1.0)
activerecord (>= 6.1.0)
concurrent-ruby (>= 1.3.1)
fugit (>= 1.11.0)
railties (>= 6.1.0)
thor (>= 1.0.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -146,7 +146,7 @@ GEM
xpath (~> 3.2)
chef-utils (18.3.0)
concurrent-ruby
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
console (1.23.2)
fiber-annotation
Expand Down Expand Up @@ -175,7 +175,7 @@ GEM
rubocop
smart_properties
erubi (1.12.0)
et-orbi (1.2.7)
et-orbi (1.2.11)
tzinfo
faraday (2.7.11)
base64
Expand All @@ -189,8 +189,8 @@ GEM
fiber-annotation (0.2.0)
fiber-local (1.0.0)
foreman (0.87.2)
fugit (1.9.0)
et-orbi (~> 1, >= 1.2.7)
fugit (1.11.0)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
gem-release (2.2.2)
github_changelog_generator (1.16.4)
Expand Down Expand Up @@ -541,7 +541,7 @@ DEPENDENCIES
yard-activesupport-concern

RUBY VERSION
ruby 3.3.1p55
ruby 3.3.3p89

BUNDLED WITH
2.5.9
4 changes: 2 additions & 2 deletions app/charts/good_job/scheduled_by_queue_chart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def data
start_time = end_time - 1.day
table_name = GoodJob::Job.table_name

count_query = Arel.sql(GoodJob::Execution.pg_or_jdbc_query(<<~SQL.squish))
count_query = Arel.sql(GoodJob::Job.pg_or_jdbc_query(<<~SQL.squish))
SELECT *
FROM generate_series(
date_trunc('hour', $1::timestamp),
Expand All @@ -35,7 +35,7 @@ def data
ActiveRecord::Relation::QueryAttribute.new('start_time', start_time, ActiveRecord::Type::DateTime.new),
ActiveRecord::Relation::QueryAttribute.new('end_time', end_time, ActiveRecord::Type::DateTime.new),
]
executions_data = GoodJob::Execution.connection.exec_query(GoodJob::Execution.pg_or_jdbc_query(count_query), "GoodJob Dashboard Chart", binds)
executions_data = GoodJob::Job.connection.exec_query(GoodJob::Job.pg_or_jdbc_query(count_query), "GoodJob Dashboard Chart", binds)

queue_names = executions_data.reject { |d| d['count'].nil? }.map { |d| d['queue_name'] || BaseFilter::EMPTY }.uniq
labels = []
Expand Down
8 changes: 0 additions & 8 deletions app/controllers/good_job/cron_entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module GoodJob
class CronEntriesController < GoodJob::ApplicationController
before_action :check_settings_migration!, only: [:enable, :disable]

def index
@cron_entries = CronEntry.all
end
Expand All @@ -30,11 +28,5 @@ def disable
@cron_entry.disable
redirect_back(fallback_location: cron_entries_path, notice: t(".notice"))
end

private

def check_settings_migration!
redirect_back(fallback_location: cron_entries_path, alert: t("good_job.cron_entries.pending_migrations")) unless GoodJob::Setting.migrated?
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/good_job/metrics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module GoodJob
class MetricsController < ApplicationController
def primary_nav
jobs_count = GoodJob::Job.count
batches_count = GoodJob::BatchRecord.migrated? ? GoodJob::BatchRecord.all.size : 0
batches_count = GoodJob::BatchRecord.all.size
cron_entries_count = GoodJob::CronEntry.all.size
processes_count = GoodJob::Process.active.count

Expand Down
14 changes: 5 additions & 9 deletions app/controllers/good_job/performances_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
module GoodJob
class PerformancesController < ApplicationController
def show
if GoodJob::DiscreteExecution.duration_interval_migrated?
@performances = GoodJob::DiscreteExecution
.where.not(job_class: nil)
.group(:job_class)
.select("
@performances = GoodJob::DiscreteExecution
.where.not(job_class: nil)
.group(:job_class)
.select("
job_class,
COUNT(*) AS executions_count,
AVG(duration) AS avg_duration,
MIN(duration) AS min_duration,
MAX(duration) AS max_duration
")
.order("job_class")
else
@needs_upgrade = true
end
.order("job_class")
end
end
end
2 changes: 1 addition & 1 deletion app/models/concerns/good_job/filterable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Filterable
next if query.blank?

# TODO: turn this into proper bind parameters in Arel
tsvector = "(to_tsvector('english', id::text) || to_tsvector('english', COALESCE(active_job_id::text, '')) || to_tsvector('english', serialized_params) || to_tsvector('english', COALESCE(error, ''))#{" || to_tsvector('english', COALESCE(array_to_string(labels, ' '), ''))" if labels_migrated?})"
tsvector = "(to_tsvector('english', id::text) || to_tsvector('english', COALESCE(active_job_id::text, '')) || to_tsvector('english', serialized_params) || to_tsvector('english', COALESCE(error, '')) || to_tsvector('english', COALESCE(array_to_string(labels, ' '), '')))"
to_tsquery_function = database_supports_websearch_to_tsquery? ? 'websearch_to_tsquery' : 'plainto_tsquery'
where("#{tsvector} @@ #{to_tsquery_function}(?)", query)
.order(sanitize_sql_for_order([Arel.sql("ts_rank(#{tsvector}, #{to_tsquery_function}(?))"), query]) => 'DESC')
Expand Down
Loading