refactor: make reconnect operation return connection

This commit is contained in:
Stavros
2025-07-17 15:06:00 +03:00
parent 00d15de44f
commit bc941cb248

View File

@@ -130,11 +130,11 @@ func (l *LDAP) reconnect() error {
operation := func() (*ldapgo.Conn, error) { operation := func() (*ldapgo.Conn, error) {
l.Conn.Close() l.Conn.Close()
_, err := l.connect() conn, err := l.connect()
if err != nil { if err != nil {
return nil, nil return nil, nil
} }
return nil, nil return conn, nil
} }
_, err := backoff.Retry(context.TODO(), operation, backoff.WithBackOff(exp), backoff.WithMaxTries(3)) _, err := backoff.Retry(context.TODO(), operation, backoff.WithBackOff(exp), backoff.WithMaxTries(3))