Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connectTimeout LdapConnection field with default value of 5000 ms. #63

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

petarov
Copy link
Contributor

@petarov petarov commented Jan 10, 2025

This PR adds a configurable connection timeout value to use when creating new TCP connections. In general the effect of this is most obvious when attempting to connect to the LDAP server for the first time. If it is not reachable, one would normally want the connection attempt to end ASAP.

In my case I connect to LDAP servers over VPN and sometimes the VPN is not on, so the extension tries to connect forever (infinity) and this forces me to close and reopen VScode.

I think it's set to 0 (infinity) by default in node-ldapjs: https://github.com/ldapjs/node-ldapjs/blob/8ffd0bc9c149088a10ec4c1ec6a18450f76ad05d/lib/client/client.js#L124

This is the timeout value to use when creating new TCP connections.
In general this is most obvious when attempting to connect to the LDAP
server for the first time. If it is not reachable one would normally want
the connection attempt to end ASAP.

For more info the node-ldapjs docs at:
https://github.com/ldapjs/node-ldapjs/blob/8ffd0bc9c149088a10ec4c1ec6a18450f76ad05d/docs/client.md#create-a-client
@fengtan fengtan merged commit b91a3bc into fengtan:master Jan 14, 2025
@fengtan
Copy link
Owner

fengtan commented Jan 14, 2025

Works fine -- merged and released as part of 1.4.1.
Thanks again @petarov!

@petarov petarov deleted the feature-add-connect-timeout branch January 16, 2025 09:47
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