Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot] 0afc2984c5 chore(deps): bump codecov/codecov-action from 6.0.1 to 7.0.0
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6.0.1 to 7.0.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/e79a6962e0d4c0c17b229090214935d2e33f8354...fb8b3582c8e4def4969c97caa2f19720cb33a72f)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-08 08:20:47 +00:00
3 changed files with 7 additions and 14 deletions
+1 -1
View File
@@ -62,6 +62,6 @@ jobs:
run: go test -coverprofile=coverage.txt -v ./...
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
+1 -1
View File
@@ -8,7 +8,7 @@ import (
)
func (app *BootstrapApp) setupServices() error {
ldapService, err := service.NewLdapService(app.log, app.config, app.ctx, app.ding)
ldapService, err := service.NewLdapService(app.log, app.config, app.ding)
if err != nil {
app.log.App.Warn().Err(err).Msg("Failed to initialize LDAP connection, will continue without it")
+5 -12
View File
@@ -17,7 +17,6 @@ import (
type LdapService struct {
log *logger.Logger
config model.Config
ctx context.Context
conn *ldapgo.Conn
mutex sync.RWMutex
@@ -27,7 +26,6 @@ type LdapService struct {
func NewLdapService(
log *logger.Logger,
config model.Config,
ctx context.Context,
dg *ding.Ding,
) (*LdapService, error) {
if config.LDAP.Address == "" {
@@ -37,7 +35,6 @@ func NewLdapService(
ldap := &LdapService{
log: log,
config: config,
ctx: ctx,
}
// Check whether authentication with client certificate is possible
@@ -66,9 +63,7 @@ func NewLdapService(
_, err := ldap.connect()
// Warn: This will hang the tinyauth startup for a good 45 seconds until it fails
if err != nil {
err = ldap.reconnect(10 * time.Second)
return nil, fmt.Errorf("failed to connect to ldap server: %w", err)
}
@@ -84,7 +79,7 @@ func NewLdapService(
err := ldap.heartbeat()
if err != nil {
ldap.log.App.Warn().Err(err).Msg("LDAP connection heartbeat failed, attempting to reconnect")
if reconnectErr := ldap.reconnect(5 * time.Second); reconnectErr != nil {
if reconnectErr := ldap.reconnect(); reconnectErr != nil {
ldap.log.App.Error().Err(reconnectErr).Msg("Failed to reconnect to LDAP server")
continue
}
@@ -252,19 +247,17 @@ func (ldap *LdapService) heartbeat() error {
return nil
}
func (ldap *LdapService) reconnect(interval time.Duration) error {
func (ldap *LdapService) reconnect() error {
ldap.log.App.Info().Msg("Attempting to reconnect to LDAP server")
exp := backoff.NewExponentialBackOff()
exp.InitialInterval = interval
exp.InitialInterval = 500 * time.Millisecond
exp.RandomizationFactor = 0.1
exp.Multiplier = 1.5
exp.Reset()
operation := func() (*ldapgo.Conn, error) {
if ldap.conn != nil {
ldap.conn.Close()
}
ldap.conn.Close()
conn, err := ldap.connect()
if err != nil {
return nil, err
@@ -272,7 +265,7 @@ func (ldap *LdapService) reconnect(interval time.Duration) error {
return conn, nil
}
_, err := backoff.Retry(ldap.ctx, operation, backoff.WithBackOff(exp), backoff.WithMaxTries(3))
_, err := backoff.Retry(context.TODO(), operation, backoff.WithBackOff(exp), backoff.WithMaxTries(3))
if err != nil {
return err