diff --git a/.circleci/config.yml b/.circleci/config.yml index e18ccde..2fca1c9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,14 +2,14 @@ version: 2.1 jobs: lint: docker: - - image: cimg/ruby:2.7.7 + - image: cimg/ruby:3.1.6 working_directory: ~/delayed_job_heartbeat_plugin steps: - checkout - restore_cache: keys: - - v1-gems-ruby-2.7.7-{{ checksum "delayed_job_heartbeat_plugin.gemspec" }}-{{ checksum "Gemfile" }} - - v1-gems-ruby-2.7.7- + - v1-gems-ruby-3.1.6-{{ checksum "delayed_job_heartbeat_plugin.gemspec" }}-{{ checksum "Gemfile" }} + - v1-gems-ruby-3.1.6- - run: name: Install Gems command: | @@ -18,7 +18,7 @@ jobs: bundle clean fi - save_cache: - key: v1-gems-ruby-2.7.7-{{ checksum "delayed_job_heartbeat_plugin.gemspec" }}-{{ checksum "Gemfile" }} + key: v1-gems-ruby-3.1.6-{{ checksum "delayed_job_heartbeat_plugin.gemspec" }}-{{ checksum "Gemfile" }} paths: - "vendor/bundle" - "gemfiles/vendor/bundle" @@ -86,12 +86,11 @@ workflows: matrix: parameters: gemfile: - - gemfiles/rails_6.0.gemfile - gemfiles/rails_6.1.gemfile - gemfiles/rails_7.0.gemfile + - gemfiles/rails_7.1.gemfile + - gemfiles/rails_7.2.gemfile ruby_version: - - 2.7.7 - - 3.0.5 - - 3.1.3 - - 3.2.0 - - 3.3.0 + - 3.1.6 + - 3.2.5 + - 3.3.4 diff --git a/.rubocop.yml b/.rubocop.yml index a985873..026c5a3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,7 +2,7 @@ inherit_gem: salsify_rubocop: conf/rubocop.yml AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.1 Exclude: - 'vendor/**/*' - 'gemfiles/**/*' diff --git a/Appraisals b/Appraisals index 9e9ff7f..153abc6 100644 --- a/Appraisals +++ b/Appraisals @@ -1,10 +1,5 @@ # frozen_string_literal: true -appraise 'rails-6.0' do - gem 'activerecord', '~> 6.0.4' - gem 'activesupport', '~> 6.0.4' -end - appraise 'rails-6.1' do gem 'activerecord', '~> 6.1.5' gem 'activesupport', '~> 6.1.5' @@ -14,3 +9,13 @@ appraise 'rails-7.0' do gem 'activerecord', '~> 7.0.2' gem 'activesupport', '~> 7.0.2' end + +appraise 'rails-7.1' do + gem 'activerecord', '~> 7.1.3' + gem 'activesupport', '~> 7.1.3' +end + +appraise 'rails-7.2' do + gem 'activerecord', '~> 7.2.0' + gem 'activesupport', '~> 7.2.0' +end diff --git a/CHANGELOG.md b/CHANGELOG.md index f841d83..518dba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.6.0 + +- Drop support for Ruby < 3.1 +- Drop Rails 6.0 +- Add Rails 7.2 + **Thanks [@DRSisco](https://github.com/DRSisco)** + ## 0.5.0 - Drop support for ruby < 2.7 diff --git a/delayed_job_heartbeat_plugin.gemspec b/delayed_job_heartbeat_plugin.gemspec index 1f0da53..218c7a0 100644 --- a/delayed_job_heartbeat_plugin.gemspec +++ b/delayed_job_heartbeat_plugin.gemspec @@ -25,12 +25,12 @@ Gem::Specification.new do |spec| spec.test_files = Dir.glob('spec/**/*') spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.7' + spec.required_ruby_version = '>= 3.1' spec.add_dependency 'delayed_job', '>= 4.1.0' spec.add_dependency 'delayed_job_active_record', '>= 4.1.0' - spec.add_development_dependency 'activerecord', ['>= 5.2', '< 7.1'] + spec.add_development_dependency 'activerecord', ['>= 6.1', '< 7.3'] spec.add_development_dependency 'appraisal' spec.add_development_dependency 'bundler' spec.add_development_dependency 'coveralls_reborn', '>= 0.18.0' @@ -39,7 +39,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3' spec.add_development_dependency 'rspec_junit_formatter' - spec.add_development_dependency 'salsify_rubocop', '~> 1.0.2' + spec.add_development_dependency 'salsify_rubocop', '~> 1.59.1' spec.add_development_dependency 'simplecov' spec.add_development_dependency 'timecop' end diff --git a/gemfiles/rails_6.0.gemfile b/gemfiles/rails_7.1.gemfile similarity index 59% rename from gemfiles/rails_6.0.gemfile rename to gemfiles/rails_7.1.gemfile index 9b80006..8b5a5a9 100644 --- a/gemfiles/rails_6.0.gemfile +++ b/gemfiles/rails_7.1.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "activerecord", "~> 6.0.4" -gem "activesupport", "~> 6.0.4" +gem "activerecord", "~> 7.1.3" +gem "activesupport", "~> 7.1.3" gemspec path: "../" diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile new file mode 100644 index 0000000..7feff34 --- /dev/null +++ b/gemfiles/rails_7.2.gemfile @@ -0,0 +1,8 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activerecord", "~> 7.2.0" +gem "activesupport", "~> 7.2.0" + +gemspec path: "../" diff --git a/lib/delayed/heartbeat/tasks.rb b/lib/delayed/heartbeat/tasks.rb index 1e4b6f4..07ac421 100644 --- a/lib/delayed/heartbeat/tasks.rb +++ b/lib/delayed/heartbeat/tasks.rb @@ -16,7 +16,7 @@ def print_results(results) puts "Deleted #{results.workers.size} and unlocked #{results.unlocked_jobs.size} orphaned jobs" - puts results.to_s if verbose? && results.present? + puts results if verbose? && results.present? end def verbose? diff --git a/lib/delayed/heartbeat/version.rb b/lib/delayed/heartbeat/version.rb index 339eab9..9181646 100644 --- a/lib/delayed/heartbeat/version.rb +++ b/lib/delayed/heartbeat/version.rb @@ -2,6 +2,6 @@ module Delayed module Heartbeat - VERSION = '0.5.0' + VERSION = '0.6.0' end end diff --git a/lib/delayed/heartbeat/worker_heartbeat.rb b/lib/delayed/heartbeat/worker_heartbeat.rb index c0dd4a5..29058b0 100644 --- a/lib/delayed/heartbeat/worker_heartbeat.rb +++ b/lib/delayed/heartbeat/worker_heartbeat.rb @@ -46,7 +46,7 @@ def run_heartbeat_loop update_heartbeat # Return the connection back to the pool since we won't be needing # it again for a while. - Delayed::Backend::ActiveRecord::Job.clear_active_connections! + Delayed::Backend::ActiveRecord::Job.connection_handler.clear_active_connections! end rescue StandardError => e # We don't want the worker to continue running if the heartbeat can't be written. @@ -58,8 +58,8 @@ def run_heartbeat_loop ensure @stop_reader.close @worker_model.delete - # Note: The built-in Delayed::Plugins::ClearLocks will unlock the jobs for us - Delayed::Backend::ActiveRecord::Job.clear_active_connections! + # NOTE: The built-in Delayed::Plugins::ClearLocks will unlock the jobs for us + Delayed::Backend::ActiveRecord::Job.connection_handler.clear_active_connections! end def update_heartbeat diff --git a/spec/delayed/heartbeat_spec.rb b/spec/delayed/heartbeat_spec.rb index f5abec3..53891f9 100644 --- a/spec/delayed/heartbeat_spec.rb +++ b/spec/delayed/heartbeat_spec.rb @@ -42,7 +42,7 @@ let!(:failed_orphaned_job) do Delayed::Job.create!(locked_by: dead_worker.name, locked_at: dead_worker.last_heartbeat_at, - payload_object: TestJobWithCallbacks.new) do |job| + payload_object: TestJobWithCallbacks.new) do |job| job.attempts = max_attempts - 1 end end