MCPcopy
hub / github.com/tinyauthapp/tinyauth / heartbeat

Method heartbeat

internal/service/ldap_service.go:240–260  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

238}
239
240func (ldap *LdapService) heartbeat() error {
241 tlog.App.Debug().Msg("Performing LDAP connection heartbeat")
242
243 searchRequest := ldapgo.NewSearchRequest(
244 "",
245 ldapgo.ScopeBaseObject, ldapgo.NeverDerefAliases, 0, 0, false,
246 "(objectClass=*)",
247 []string{},
248 nil,
249 )
250
251 ldap.mutex.Lock()
252 defer ldap.mutex.Unlock()
253 _, err := ldap.conn.Search(searchRequest)
254 if err != nil {
255 return err
256 }
257
258 // No error means the connection is alive
259 return nil
260}
261
262func (ldap *LdapService) reconnect() error {
263 tlog.App.Info().Msg("Reconnecting to LDAP server")

Callers 1

InitMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected