Skip to content

Commit 5598bc8

Browse files
committed
add reconnects
1 parent 8f3f461 commit 5598bc8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

controllers/account_server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package controllers
1919
import (
2020
"context"
2121
"strings"
22+
"time"
2223

2324
"k8s.io/apimachinery/pkg/api/errors"
2425
"k8s.io/apimachinery/pkg/runtime"
@@ -48,7 +49,7 @@ func NewAccountServer() *NatsAccountServer {
4849
func (r *NatsAccountServer) Run(ctx context.Context, url string, credsFile string) error {
4950
logger := log.FromContext(ctx)
5051
logger.Info("Connecting to nats", "server", url)
51-
nc, err := nats.Connect(url, nats.UserCredentials(credsFile))
52+
nc, err := nats.Connect(url, nats.UserCredentials(credsFile), nats.RetryOnFailedConnect(true), nats.MaxReconnects(-1), nats.ReconnectWait(1*time.Second))
5253
if err != nil {
5354
return err
5455
}

0 commit comments

Comments
 (0)