Skip to content

Commit

Permalink
check exit status on close
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolik committed Aug 2, 2024
1 parent 46181e8 commit 32e6a8e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/controller/valkey_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ func (r *ValkeyReconciler) balanceNodes(ctx context.Context, valkey *hyperv1.Val
for {
network, err := net.Dial("tcp", addr+":6379")
if err != nil {
network.Close()
if err := network.Close(); err != nil {
logger.Error(err, "failed to close network", "valkey", valkey.Name, "namespace", valkey.Namespace)
}
time.Sleep(time.Second * 2)
dial++
if dial > 60 {
Expand All @@ -468,7 +470,9 @@ func (r *ValkeyReconciler) balanceNodes(ctx context.Context, valkey *hyperv1.Val
continue
}
if network != nil {
network.Close()
if err := network.Close(); err != nil {
logger.Error(err, "failed to close network", "valkey", valkey.Name, "namespace", valkey.Namespace)
}
} else {
time.Sleep(time.Second * 2)
dial++
Expand Down

0 comments on commit 32e6a8e

Please sign in to comment.