Skip to content

Commit

Permalink
add timeout to tcp checker
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Richter <[email protected]>
  • Loading branch information
dragonchaser committed Oct 14, 2024
1 parent 941e688 commit 6064386
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ocis-pkg/handlers/checktcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package handlers
import (
"context"
"net"
"time"
)

// NewTCPCheck returns a check that connects to a given tcp endpoint.
func NewTCPCheck(address string) func(ctx context.Context) error {
return func(_ context.Context) error {
conn, err := net.Dial("tcp", address)
conn, err := net.DialTimeout("tcp", address, 3*time.Second)
if err != nil {
return err
}
Expand Down

0 comments on commit 6064386

Please sign in to comment.