Skip to content

Commit ddb252b

Browse files
committed
Change example jitter values since those are the defaults now
Document that libraries will use default values if the ReconnectJitter option is not specified. Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
1 parent 7a2e69f commit ddb252b

File tree

1 file changed

+3
-3
lines changed
  • developing-with-nats/reconnect

1 file changed

+3
-3
lines changed

developing-with-nats/reconnect/wait.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ nc.close();
7878
{% endtab %}
7979
{% endtabs %}
8080

81-
Some libraries will allow you to specify some random jitter to add to the reconnect wait specified above.
81+
Some libraries will allow you to specify some random jitter to add to the reconnect wait specified above. If not specified, the library will default to 100 milliseconds for non TLS connections and 1 second for TLS connections. After all servers in the list have been tried, the library will get a random value between 0 and the reconnect jitter, and add that to the reconnect wait option.
8282

8383
{% tabs %}
8484
{% tab title="Go" %}
8585
```go
86-
// Set some jitter up to 100 millisecond for non TLS connections and 1 second for TLS connections.
87-
nc, err := nats.Connect("demo.nats.io", nats.ReconnectJitter(100*time.Millisecond, 1*time.Second))
86+
// Set some jitter to add to the reconnect wait duration: up to 500 milliseconds for non TLS connections and up to 2 seconds for TLS connections.
87+
nc, err := nats.Connect("demo.nats.io", nats.ReconnectJitter(500*time.Millisecond, 2*time.Second))
8888
if err != nil {
8989
log.Fatal(err)
9090
}

0 commit comments

Comments
 (0)