From d634e7dfabb32a07f8727e4417fe1388d47de8b2 Mon Sep 17 00:00:00 2001 From: Kishan B Date: Wed, 30 Mar 2022 11:32:44 +0530 Subject: [PATCH 1/2] Explicitly document the default values --- backoff.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/backoff.go b/backoff.go index d113e68..f6bce50 100644 --- a/backoff.go +++ b/backoff.go @@ -16,12 +16,26 @@ import ( // be used concurrently. type Backoff struct { attempt uint64 - // Factor is the multiplying factor for each increment step + + // Factor is the multiplying factor for each increment step. + // + // Defaults to 2. Factor float64 - // Jitter eases contention by randomizing backoff steps + + // Jitter eases contention by randomizing backoff steps. + // + // Defaults to false. Jitter bool - // Min and Max are the minimum and maximum values of the counter - Min, Max time.Duration + + // Minimum value of the counter. + // + // Defaults to 100 milliseconds. + Min + + // Maximum value of the counter. + // + // Defaults to 10 seconds. + Max time.Duration } // Duration returns the duration for the current attempt before incrementing From 153e0dbc3bfafe0c48f40e3d5d5eee9c6957171a Mon Sep 17 00:00:00 2001 From: Kishan B Date: Wed, 30 Mar 2022 13:19:32 +0530 Subject: [PATCH 2/2] Fix compilation issue and formatting --- backoff.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backoff.go b/backoff.go index f6bce50..27898f3 100644 --- a/backoff.go +++ b/backoff.go @@ -16,22 +16,22 @@ import ( // be used concurrently. type Backoff struct { attempt uint64 - + // Factor is the multiplying factor for each increment step. // // Defaults to 2. Factor float64 - + // Jitter eases contention by randomizing backoff steps. // // Defaults to false. Jitter bool - + // Minimum value of the counter. // // Defaults to 100 milliseconds. - Min - + Min time.Duration + // Maximum value of the counter. // // Defaults to 10 seconds.