Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve healtcheck implementation #111

Merged
merged 4 commits into from
Jan 2, 2025

Conversation

Abdulsametileri
Copy link
Member

Hello, when I investigated our current healthcheck implementation, I realized that

  • Start Stop method is unsafe for concurrent access, (running boolean flag can be accessed by multiple goroutines) instead of sync.Once. I know, we invoked based on this but I think ensuring this is best practice.
  • Relying on running flag stopping, clearing resources, (cancellation) instead of context.
  • time.Sleep (can lead to less precise timing and harder-to-manage) instead of time.Ticker
  • Need to enhace logging like logger.Log.Warn("Health check attempt %d/%d failed: %v", attempt, maxRetries, err)
  • Unit tests missing

I tested implementation with single application and couchbase container, with this example

Maybe we can add backoff instead of constant time.Second interval

@erayarslan erayarslan merged commit f29c7a9 into master Jan 2, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants