Skip to content

Commit

Permalink
chore: fix race cond.
Browse files Browse the repository at this point in the history
  • Loading branch information
y-eight committed Nov 27, 2023
1 parent 8e7cc5a commit dfb2bcc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/checks/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type Target struct {
// Constructor for the HealthCheck
func GetHealthCheck() Check {
return &Health{
route: "/checks/health",
route: "health",
}
}

Expand Down Expand Up @@ -148,6 +148,7 @@ func (h *Health) Check(ctx context.Context) healthData {

go func() {
defer wg.Done()

targetData := Target{
Target: target,
Status: "healthy",
Expand Down Expand Up @@ -177,8 +178,9 @@ func (h *Health) Check(ctx context.Context) healthData {
func getHealth(ctx context.Context, url string) error {
log := logger.FromContext(ctx).With("url", url)

client := http.DefaultClient
client.Timeout = time.Second * 5
client := &http.Client{
Timeout: time.Second * 5,
}

req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
if err != nil {
Expand Down

0 comments on commit dfb2bcc

Please sign in to comment.