Skip to content

Commit

Permalink
chore: logging time
Browse files Browse the repository at this point in the history
  • Loading branch information
geraldofada committed May 28, 2024
1 parent e91a033 commit ca47583
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion checks/mongo/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"crypto/tls"
"errors"
"fmt"
"sync"
"time"

Expand All @@ -16,7 +17,7 @@ import (

var (
conn *mongo.Client
ConnectionTimeout = 3 * time.Second
ConnectionTimeout = 999 * time.Second
mu sync.RWMutex
)

Expand Down Expand Up @@ -59,11 +60,16 @@ func (service *healthCheck) executeCheck() error {
return errors.New("URL is empty")
}

start := time.Now()
_, err := service.connectMongo()
elapsed := time.Since(start)

if err != nil {
return err
}

fmt.Println("Elapsed time: ", elapsed)

return ping()
}

Expand Down

0 comments on commit ca47583

Please sign in to comment.