Skip to content

Conversation

@HarlemSquirrel
Copy link
Member

@HarlemSquirrel HarlemSquirrel commented Jul 22, 2020

# Example usage
ldap_with_pool = Net::LDAP.new(
  host: host_name,
  port: 389, 
  connection_pool: { 
    size: 4, # Maximum connections to open
    timeout: 15 # Number of seconds to wait for a connection to free up before raising a timeout error
  }
)

See https://github.com/mperham/connection_pool#usage

s.required_ruby_version = ">= 2.0.0"
s.summary = %q{Net::LDAP for Ruby (also called net-ldap) implements client access for the Lightweight Directory Access Protocol (LDAP), an IETF standard protocol for accessing distributed directory services}

s.add_runtime_dependency("connection_pool", "~> 2.2")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we want to make this a requirement or allow users to opt in by adding the gem in their Gemfile. If we do that, then we have to handle when the library is missing.

@encryption = normalize_encryption(args[:encryption]) # may be nil
@connect_timeout = args[:connect_timeout]
if args[:connection_pool].is_a? Hash
options = { size: 5, timeout: (@connection_timeout || 5) }.merge args[:connection_pool]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should default the timeout here in this way. The time to wait for a connection to free up is not quite the same as waiting for a single connection to be made. Perhaps we should default so some higher value here like 30 seconds.

@HarlemSquirrel HarlemSquirrel deleted the connection-pool-20200722 branch June 6, 2023 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants