From 2e9452feab678b06bb7e0186ef9ab6cdfd9bc394 Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Wed, 13 May 2020 19:21:06 -0600 Subject: [PATCH] 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 --- developing-with-nats/reconnect/wait.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/developing-with-nats/reconnect/wait.md b/developing-with-nats/reconnect/wait.md index be7ba8e11..d878228e9 100644 --- a/developing-with-nats/reconnect/wait.md +++ b/developing-with-nats/reconnect/wait.md @@ -99,13 +99,13 @@ natsOptions_Destroy(opts); {% endtab %} {% endtabs %} -Some libraries will allow you to specify some random jitter to add to the reconnect wait specified above. +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. {% tabs %} {% tab title="Go" %} ```go -// Set some jitter up to 100 millisecond for non TLS connections and 1 second for TLS connections. -nc, err := nats.Connect("demo.nats.io", nats.ReconnectJitter(100*time.Millisecond, 1*time.Second)) +// 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. +nc, err := nats.Connect("demo.nats.io", nats.ReconnectJitter(500*time.Millisecond, 2*time.Second)) if err != nil { log.Fatal(err) }