feat: add a reconnect to the initial ldap connection#928
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesLDAP reconnect & context wiring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/service/ldap_service.go`:
- Around line 66-70: The startup blocking retry in ldap_service.go (the call to
ldap.reconnect(...) inside the error branch after connection attempt) causes
~47.5s delay; either remove this startup reconnect entirely so setup continues
on LDAP failure (relying on existing heartbeat reconnect logic), or drastically
shorten it (e.g., call ldap.reconnect with a single short interval / 1–2 second
attempts or implement max 1-2 retries) and update the comment to reflect the
actual delay; locate the error handling around ldap.reconnect and adjust the
call and/or comment accordingly so BootstrapApp.setupServices will not block for
~47.5s when LDAP is unavailable.
- Around line 67-69: The logic in NewLdapService incorrectly returns nil even
when ldap.reconnect succeeds: adjust the error handling in the initial connect
branch (where err != nil) to call ldap.reconnect(10 * time.Second) and check its
return error; if reconnect returns nil then return the ldap pointer and nil
error, otherwise return nil and the wrapped reconnect error (fmt.Errorf("failed
to connect to ldap server: %w", err)). Ensure you reference the ldap variable
created in NewLdapService and only return nil when reconnect actually fails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 90ca0a54-2e80-4d2f-8a87-9283a697d90d
📒 Files selected for processing (1)
internal/service/ldap_service.go
Summary by CodeRabbit