From 7aaddbf8cc68877f3230ca773243041727fbb118 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 23 Nov 2017 18:21:13 +0000
Subject: [PATCH] Add docstrings

---
 clientutil/retry.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/clientutil/retry.go b/clientutil/retry.go
index 42730d2..ae5159f 100644
--- a/clientutil/retry.go
+++ b/clientutil/retry.go
@@ -9,6 +9,8 @@ import (
 	"github.com/cenkalti/backoff"
 )
 
+// NewExponentialBackOff creates a backoff.ExponentialBackOff object
+// with our own default values.
 func NewExponentialBackOff() *backoff.ExponentialBackOff {
 	b := backoff.NewExponentialBackOff()
 	b.InitialInterval = 100 * time.Millisecond
@@ -16,6 +18,7 @@ func NewExponentialBackOff() *backoff.ExponentialBackOff {
 	return b
 }
 
+// Retry operation op until it succeeds according to the backoff policy b.
 func Retry(op backoff.Operation, b backoff.BackOff) error {
 	innerOp := func() error {
 		err := op()
@@ -32,6 +35,10 @@ func Retry(op backoff.Operation, b backoff.BackOff) error {
 
 var errHTTPBackOff = errors.New("http status 503")
 
+// RetryHTTPDo retries an HTTP request until it succeeds, according to
+// the backoff policy b. It will retry on temporary network errors and
+// upon receiving specific throttling HTTP errors (currently just
+// status code 503).
 func RetryHTTPDo(client *http.Client, req *http.Request, b backoff.BackOff) (*http.Response, error) {
 	var resp *http.Response
 	op := func() error {
-- 
GitLab