Skip to content

Commit

Permalink
Rejigger to remove errors.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Jun 2, 2020
1 parent 35a8891 commit 8b830d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
14 changes: 10 additions & 4 deletions lib/connection_pool.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
require "timeout"
require "connection_pool/version"
require "connection_pool/errors"
require "connection_pool/timed_stack"
require "connection_pool/wrapper"

class ConnectionPool
class Error < ::RuntimeError; end
class PoolShuttingDownError < ::ConnectionPool::Error; end
class TimeoutError < ::Timeout::Error; end
end

# Generic connection pool class for sharing a limited number of objects or network connections
# among many threads. Note: pool elements are lazily created.
#
# Example usage with block (faster):
#
# @pool = ConnectionPool.new { Redis.new }
#
# @pool.with do |redis|
# redis.lpop('my-list') if redis.llen('my-list') > 0
# end
Expand Down Expand Up @@ -102,3 +105,6 @@ def available
@available.length
end
end

require "connection_pool/timed_stack"
require "connection_pool/wrapper"
7 changes: 0 additions & 7 deletions lib/connection_pool/errors.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/connection_pool/timed_stack.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "connection_pool/errors"

##
# The TimedStack manages a pool of homogeneous connections (or any resource
# you wish to manage). Connections are created lazily up to a given maximum
Expand Down

0 comments on commit 8b830d2

Please sign in to comment.