// NewRetryRepository wraps a distribution.Repository with helpers that will retry authentication failures
// over a limited time window and duration. This primarily avoids a DockerHub issue where public images
// unexpectedly return a 401 error due to the JWT token created by the hub being created at the same second,
// but another server being in the previous second.
NewRetryRepository wraps a distribution.Repository with helpers that will retry authentication failures
over a limited time window and duration. This primarily avoids a DockerHub issue where public images
unexpectedly return a 401 error due to the JWT token created by the hub being created at the same second,
but another server being in the previous second.
// NewRetryRepository wraps a distribution . Repository with helpers that will retry authentication failures // over a limited time window and duration . This primarily avoids a DockerHub issue where public images // unexpectedly return a 401 error due to the JWT token created by the hub being created at the same second // but another server being in the previous second .
func NewRetryRepository(repo distribution.Repository, retries int, interval time.Duration) distribution.Repository {
	var wait time.Duration
	if retries > 1 {
		wait = interval / time.Duration(retries-1)
	}
	return &retryRepository{
		Repository: repo,
		retries: retries,
		wait:    wait,
	}
}
func NewRetryRepository ( repo distribution . Repository , retries int , interval time . Duration ) distribution . Repository { var wait time . Duration if retries > 1 { wait = interval / time . Duration ( retries - 1 ) } return & retryRepository { Repository : repo , retries : retries , wait : wait , } }
NewRetryRepository wraps a distribution.Repository with helpers that will retry authentication failures
over a limited time window and duration.
NewRetryRepository wraps a distribution . Repository with helpers that will retry authentication failures over a limited time window and duration .