This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new de8d4e29 Avoid creating connection unnecessarily
de8d4e29 is described below

commit de8d4e29c50c102ecbaf00e6af460ce497135041
Author: Sebb <[email protected]>
AuthorDate: Fri Jan 6 01:29:53 2023 +0000

    Avoid creating connection unnecessarily
---
 lib/whimsy/asf/ldap.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index d3bbc024..986d0c0f 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -102,7 +102,11 @@ module ASF
       dn = ASF::Person.new(user).dn
       raise ::LDAP::ResultError.new('Unknown user') unless dn
 
-      ASF.ldap.unbind if ASF.ldap.bound? rescue nil
+      begin
+        @ldap.unbind if @ldap&.bound?
+      rescue StandardError
+        # ignore
+      end
       ldap = ASF._init_ldap(true, self.rwhosts)
       if block
         ASF.flush_weakrefs

Reply via email to