Skip to content

Commit

Permalink
Setting should configure the Redis pool size, fixes #5702
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Dec 21, 2022
1 parent 1ef2e12 commit 0c1e466
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
HEAD
----------

- Fix `size: X` for configuring the default Redis pool size [#5702]
- Improve the display of queue weights on Busy page [#5642]
- Freeze CurrentAttributes on a job once initially set [#5692]

Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def redis_pool
def new_redis_pool(size, name = "unset")
# connection pool is lazy, it will not create connections unless you actually need them
# so don't be skimpy!
RedisConnection.create(@redis_config.merge(size: size, logger: logger, pool_name: name))
RedisConnection.create({size: size, logger: logger, pool_name: name}.merge(@redis_config))
end

def redis_info
Expand Down
19 changes: 19 additions & 0 deletions test/config_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require_relative "helper"

describe Sidekiq::Config do
before do
@config = reset!
end

it "provides a default size" do
@config.redis = {}
assert_equal 5, @config.redis_pool.size
end

it "allows custom sizing" do
@config.redis = {size: 3}
assert_equal 3, @config.redis_pool.size
end
end

0 comments on commit 0c1e466

Please sign in to comment.