Skip to content

Commit

Permalink
BREAKING: support Sidekiq 7+
Browse files Browse the repository at this point in the history
This removes support for Sidekiq < 7 and Ruby < 3.2.
  • Loading branch information
tgxworld authored and dmke committed Nov 13, 2024
1 parent eec44cf commit 8c78db9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- sidekiq-7

jobs:
lint:
Expand Down Expand Up @@ -33,13 +34,14 @@ jobs:

services:
redis:
image: redis
image: ${{ matrix.redis }}
ports:
- 6379:6379

strategy:
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ["3.2", "3.3"]
redis: ["redis", "valkey/valkey"]

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# next

- Remove support for Sidekiq < 7
- Update minimum Ruby version to 3.2

# 0.17.0 - 2024-08-06

- Add `MiniScheduler::Manager.discover_running_scheduled_jobs` API to allow running scheduled jobs to easily be discovered on the
Expand Down
13 changes: 2 additions & 11 deletions lib/mini_scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require "mini_scheduler/manager"
require "mini_scheduler/distributed_mutex"
require "sidekiq"
require "redis"

begin
require "sidekiq/exception_handler"
Expand All @@ -16,16 +17,6 @@ def self.configure
yield self
end

class SidekiqExceptionHandler
if defined?(Sidekiq::ExceptionHandler)
extend Sidekiq::ExceptionHandler
else
def self.handle_exception(exception, context)
Sidekiq.handle_exception(exception, context)
end
end
end

def self.job_exception_handler(&blk)
@job_exception_handler = blk if blk
@job_exception_handler
Expand All @@ -35,7 +26,7 @@ def self.handle_job_exception(ex, context = {})
if job_exception_handler
job_exception_handler.call(ex, context)
else
SidekiqExceptionHandler.handle_exception(ex, context)
Sidekiq.default_configuration.handle_exception(ex, context)
end
end

Expand Down
4 changes: 2 additions & 2 deletions mini_scheduler.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/discourse/mini_scheduler"
spec.license = "MIT"

spec.required_ruby_version = ">= 2.7.0"
spec.required_ruby_version = ">= 3.2.0"

spec.files = `git ls-files`.split($/).reject { |s| s =~ /^(spec|\.)/ }
spec.require_paths = ["lib"]

spec.add_runtime_dependency "sidekiq", ">= 4.2.3", "< 7.0"
spec.add_runtime_dependency "sidekiq", ">= 7.0", "< 8.0"

spec.add_development_dependency "pg", "~> 1.0"
spec.add_development_dependency "activesupport", "~> 7.0"
Expand Down
4 changes: 2 additions & 2 deletions spec/mini_scheduler/manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@ def call(ex, ctx)

let(:logger) { TempSidekiqLogger.new }

before { Sidekiq.error_handlers << logger }
before { Sidekiq.default_configuration.error_handlers << logger }

after { Sidekiq.error_handlers.delete(logger) }
after { Sidekiq.default_configuration.error_handlers.delete(logger) }

it "captures failed jobs" do
manager.blocking_tick
Expand Down

0 comments on commit 8c78db9

Please sign in to comment.