diff options
Diffstat (limited to 'vendor/gopkg.in/throttled/throttled.v2/rate.go')
-rw-r--r-- | vendor/gopkg.in/throttled/throttled.v2/rate.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/vendor/gopkg.in/throttled/throttled.v2/rate.go b/vendor/gopkg.in/throttled/throttled.v2/rate.go index 649287beb..8c11cdb47 100644 --- a/vendor/gopkg.in/throttled/throttled.v2/rate.go +++ b/vendor/gopkg.in/throttled/throttled.v2/rate.go @@ -84,18 +84,17 @@ type Rate struct { // RateQuota describes the number of requests allowed per time period. // MaxRate specified the maximum sustained rate of requests and must -// be greater than zero. MaxBurst defines the number of requests that +// be greater than zero. MaxBurst defines the number of requests that // will be allowed to exceed the rate in a single burst and must be // greater than or equal to zero. // // Rate{PerSec(1), 0} would mean that after each request, no more -// requests will be permitted for that client for one second. -// Rate{PerSec(2), 0} permits one request per 0.5 seconds rather than -// two requests in one second. In practice, you probably want to set -// MaxBurst >0 to provide some flexibility to clients that only need -// to make a handful of requests. In fact a MaxBurst of zero will -// *never* permit a request with a quantity greater than one because -// it will immediately exceed the limit. +// requests will be permitted for that client for one second. In +// practice, you probably want to set MaxBurst >0 to provide some +// flexibility to clients that only need to make a handful of +// requests. In fact a MaxBurst of zero will *never* permit a request +// with a quantity greater than one because it will immediately exceed +// the limit. type RateQuota struct { MaxRate Rate MaxBurst int @@ -119,12 +118,10 @@ func PerDay(n int) Rate { return Rate{24 * time.Hour / time.Duration(n), n} } // as for limiting the number of bytes uploaded. type GCRARateLimiter struct { limit int - // Think of the DVT as our flexibility: // How far can you deviate from the nominal equally spaced schedule? // If you like leaky buckets, think about it as the size of your bucket. delayVariationTolerance time.Duration - // Think of the emission interval as the time between events // in the nominal equally spaced schedule. If you like leaky buckets, // think of it as how frequently the bucket leaks one unit. |