Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: arturictus/sidekiq_alive
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.3.0
Choose a base ref
...
head repository: arturictus/sidekiq_alive
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.3.1
Choose a head ref
  • 2 commits
  • 5 files changed
  • 2 contributors

Commits on Oct 17, 2023

  1. proposed SIDEKIQ_ALIVE_CONCURRENCY configuration (#102)

    * proposed SIDEKIQ_ALIVE_CONCURRENCY configuration
    
    * update README to include new configuration item and environment variable
    koconnor-ampion authored Oct 17, 2023
    Copy the full SHA
    a5450de View commit details
  2. Update version to 2.3.1

    github-actions committed Oct 17, 2023
    Copy the full SHA
    9d26a9b View commit details
Showing with 23 additions and 3 deletions.
  1. +8 −0 README.md
  2. +1 −1 lib/sidekiq_alive.rb
  3. +3 −1 lib/sidekiq_alive/config.rb
  4. +1 −1 lib/sidekiq_alive/version.rb
  5. +10 −0 spec/sidekiq_alive_spec.rb
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -268,6 +268,14 @@ SidekiqAlive.setup do |config|
# default: 'webrick'
#
# config.server = 'puma'

# ==> Concurrency
# The maximum number of Redis connections requested for the SidekiqAlive pool.
# Can also be set with the environment variable SIDEKIQ_ALIVE_CONCURRENCY.
# NOTE: only effects Sidekiq 7 or greater.
# default: 2
#
# config.concurrency = 3
end
```

2 changes: 1 addition & 1 deletion lib/sidekiq_alive.rb
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ def start

if Helpers.sidekiq_7
sq_config.capsule(CAPSULE_NAME) do |cap|
cap.concurrency = 2
cap.concurrency = config.concurrency
cap.queues = [current_queue]
end
else
4 changes: 3 additions & 1 deletion lib/sidekiq_alive/config.rb
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@ class Config
:server,
:custom_liveness_probe,
:logger,
:shutdown_callback
:shutdown_callback,
:concurrency

def initialize
set_defaults
@@ -33,6 +34,7 @@ def set_defaults
@server = ENV.fetch("SIDEKIQ_ALIVE_SERVER", "webrick")
@custom_liveness_probe = proc { true }
@shutdown_callback = proc {}
@concurrency = Integer(ENV.fetch("SIDEKIQ_ALIVE_CONCURRENCY", 2), exception: false) || 2
end

def registration_ttl
2 changes: 1 addition & 1 deletion lib/sidekiq_alive/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module SidekiqAlive
VERSION = "2.3.0"
VERSION = "2.3.1"
end
10 changes: 10 additions & 0 deletions spec/sidekiq_alive_spec.rb
Original file line number Diff line number Diff line change
@@ -48,6 +48,16 @@
ENV["SIDEKIQ_ALIVE_PORT"] = nil
end

it "configures the concurrency from the SIDEKIQ_ALIVE_CONCURRENCY ENV var" do
ENV["SIDEKIQ_ALIVE_CONCURRENCY"] = "3"

SidekiqAlive.config.set_defaults

expect(described_class.config.concurrency).to(eq(3))

ENV["SIDEKIQ_ALIVE_CONCURRENCY"] = nil
end

it "configurations behave as expected" do
k = described_class.config