Skip to content

Commit

Permalink
Fixed pool options for Redis 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rykov committed Oct 29, 2023
1 parent 06af8fe commit c0388d6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@ on:
jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, head, jruby]
ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "head", "jruby"]
redis: ["3.0", "4.0", "5.0"]
exclude:
- ruby: "2.3"
redis: "5.0"
- ruby: "2.4"
redis: "5.0"

env:
REDIS_VERSION: "${{matrix.redis}}"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby & run Bundler
uses: ruby/setup-ruby@v1
with:
Expand Down
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
source "https://rubygems.org"

REDIS_VERSION = ENV.fetch("REDIS_VERSION", '5.0').freeze

# Gemspec only lists command-line tool dependencies
gemspec

# Not-required for execution
group :development, :test do
gem 'redis', "~> #{REDIS_VERSION}"
gem 'rake', '>= 12.3.3'
gem 'rspec', '~> 3.0'
gem 'redis', '< 4.0'
end
end
2 changes: 1 addition & 1 deletion lib/pools/connection_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def initialize(pooled, options)
@timeout = options[:wait_timeout] || 5

# default max pool size to 5
@size = (options[:pool] && options[:pool].to_i) || 5
@size = (@options.delete(:pool) || 5).to_i

@connections = []
@checked_out = []
Expand Down
4 changes: 3 additions & 1 deletion lib/pools/pooled.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ module Pooled

def initialize(*args)
options = args.extract_options!
pool_name = options.delete(:pool_name)

@preparation_chain = []
@connection_pool = ConnectionPool.new(self, options)
Pools.handler.add(@connection_pool, options[:pool_name])
Pools.handler.add(@connection_pool, pool_name)
end

def with_connection(&block)
Expand Down
2 changes: 1 addition & 1 deletion pools.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "pools"
s.version = "2.0.0"
s.version = "2.0.1"
s.date = Time.now.strftime('%Y-%m-%d')
s.summary = "Generalized connection pooling"
s.homepage = "http://github.com/rykov/pools"
Expand Down

0 comments on commit c0388d6

Please sign in to comment.