diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-11-13 09:09:58 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-13 09:09:58 -0800 |
commit | 1329aa51b605cb54ba9aae3a82a0a87b881fb7b3 (patch) | |
tree | 93cbf354ab894a560fc2cef8ef685d681b4ff889 /vendor/gopkg.in/throttled/throttled.v2/rate.go | |
parent | 7304a61ef597970be3031b14e652fb3a4df44304 (diff) | |
download | chat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.tar.gz chat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.tar.bz2 chat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.zip |
Updating server dependancies. (#7816)
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, 10 insertions, 7 deletions
diff --git a/vendor/gopkg.in/throttled/throttled.v2/rate.go b/vendor/gopkg.in/throttled/throttled.v2/rate.go index 8c11cdb47..649287beb 100644 --- a/vendor/gopkg.in/throttled/throttled.v2/rate.go +++ b/vendor/gopkg.in/throttled/throttled.v2/rate.go @@ -84,17 +84,18 @@ 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. 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. +// 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. type RateQuota struct { MaxRate Rate MaxBurst int @@ -118,10 +119,12 @@ 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. |