Skip to content

Commit

Permalink
Update compatibility matrix, remove compatibility code (#1465)
Browse files Browse the repository at this point in the history
* Update compatibility for v4

Ruby and rails versions are enforced through the gemspec.
Support for older postgres versions was accidentally left in and
it's now too late to drop support for these.

* Remove old compatibility code
  • Loading branch information
Earlopain authored Aug 16, 2024
1 parent 59c3300 commit cc9784d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
pg: [16]
include:
- ruby: 3.3
pg: 11
pg: 10

env:
PGHOST: localhost
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla

## Compatibility

- **Ruby on Rails:** 6.0+
- **Ruby:** Ruby 2.6+. JRuby 9.3+
- **Ruby on Rails:** 6.1+
- **Ruby:** Ruby 3.0+. JRuby 9.4+
- **Postgres:** 10.0+

## Configuration
Expand Down Expand Up @@ -890,7 +890,7 @@ To upgrade:
Notable changes:
- Only supports Rails 6.1+, CRuby 3.0+ and JRuby 9.4+, Postgres 12+. Rails 6.0 is no longer supported. CRuby 2.6 and 2.7 are no longer supported. JRuby 9.3 is no longer supported.
- Only supports Rails 6.1+, CRuby 3.0+ and JRuby 9.4+. Rails 6.0 is no longer supported. CRuby 2.6 and 2.7 are no longer supported. JRuby 9.3 is no longer supported.
- Changes job `priority` to give smaller numbers higher priority (default: `0`), in accordance with Active Job's definition of priority.
- Enqueues and executes jobs via the `GoodJob::Job` model instead of `GoodJob::Execution`
- Setting `config.good_job.cleanup_interval_jobs`, `GOOD_JOB_CLEANUP_INTERVAL_JOBS`, `config.good_job.cleanup_interval_seconds`, or `GOOD_JOB_CLEANUP_INTERVAL_SECONDS` to `nil` or `""` no longer disables count- or time-based cleanups. Set to `false` to disable, or `-1` to run a cleanup after every job execution.
Expand Down
6 changes: 1 addition & 5 deletions app/models/good_job/batch_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ def self.load(value)
end
end

if Rails.gem_version < Gem::Version.new('6.1.0.alpha')
# serialize does not yet take a default value, must set via Attributes API
attribute :serialized_properties, :json, default: -> { {} }
serialize :serialized_properties, PropertySerializer
elsif Rails.gem_version < Gem::Version.new('7.1.0.alpha')
if Rails.gem_version < Gem::Version.new('7.1.0.alpha')
serialize :serialized_properties, PropertySerializer, default: -> { {} }
else
serialize :serialized_properties, coder: PropertySerializer, default: -> { {} }
Expand Down
6 changes: 1 addition & 5 deletions demo/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
config.active_job.queue_adapter = :test

# Raises error for missing translations.
if Gem::Version.new(Rails.version) < Gem::Version.new('6.1')
config.action_view.raise_on_missing_translations = true
else
config.i18n.raise_on_missing_translations = true
end
config.i18n.raise_on_missing_translations = true

config.colorize_logging = false if ENV["CI"]
if ActiveModel::Type::Boolean.new.cast(ENV['RAILS_LOG_TO_STDOUT'])
Expand Down
10 changes: 4 additions & 6 deletions spec/lib/good_job/active_job_extensions/concurrency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def perform(name:)
end

describe '.good_job_control_concurrency_with' do
describe 'total_limit:', :skip_rails_5 do
describe 'total_limit:' do
before do
TestJob.good_job_control_concurrency_with(
total_limit: -> { 1 },
Expand All @@ -75,7 +75,7 @@ def perform(name:)
end
end

describe 'enqueue_limit:', :skip_rails_5 do
describe 'enqueue_limit:' do
before do
TestJob.good_job_control_concurrency_with(
enqueue_limit: -> { 2 },
Expand All @@ -99,10 +99,8 @@ def perform(name:)
expect(GoodJob::Job.where(concurrency_key: "Bob").count).to eq 1

expect(TestJob.logger.formatter).to have_received(:call).with("INFO", anything, anything, a_string_matching(/Aborted enqueue of TestJob \(Job ID: .*\) because the concurrency key 'Alice' has reached its enqueue limit of 2 jobs/)).exactly(:once)
if ActiveJob.gem_version >= Gem::Version.new("6.1.0")
expect(TestJob.logger.formatter).to have_received(:call).with("INFO", anything, anything, a_string_matching(/Enqueued TestJob \(Job ID: .*\) to \(default\) with arguments: {:name=>"Alice"}/)).exactly(:twice)
expect(TestJob.logger.formatter).to have_received(:call).with("INFO", anything, anything, a_string_matching(/Enqueued TestJob \(Job ID: .*\) to \(default\) with arguments: {:name=>"Bob"}/)).exactly(:once)
end
expect(TestJob.logger.formatter).to have_received(:call).with("INFO", anything, anything, a_string_matching(/Enqueued TestJob \(Job ID: .*\) to \(default\) with arguments: {:name=>"Alice"}/)).exactly(:twice)
expect(TestJob.logger.formatter).to have_received(:call).with("INFO", anything, anything, a_string_matching(/Enqueued TestJob \(Job ID: .*\) to \(default\) with arguments: {:name=>"Bob"}/)).exactly(:once)
end

it 'excludes jobs that are already executing/locked' do
Expand Down
6 changes: 0 additions & 6 deletions spec/support/rails_versions.rb

This file was deleted.

0 comments on commit cc9784d

Please sign in to comment.