diff --git a/src/runtime/virtcontainers/fc.go b/src/runtime/virtcontainers/fc.go index cb6e3a2601..384ce15a12 100644 --- a/src/runtime/virtcontainers/fc.go +++ b/src/runtime/virtcontainers/fc.go @@ -930,7 +930,7 @@ func (fc *firecracker) fcAddNetDevice(ctx context.Context, endpoint Endpoint) { // The implementation of rate limiter is based on TBF. // Rate Limiter defines a token bucket with a maximum capacity (size) to store tokens, and an interval for refilling purposes (refill_time). // The refill-rate is derived from size and refill_time, and it is the constant rate at which the tokens replenish. - refillTime := uint64(1000) + refillTime := uint64(utils.DefaultRateLimiterRefillTimeMilliSecs) var rxRateLimiter models.RateLimiter rxSize := fc.config.RxRateLimiterMaxRate if rxSize > 0 { diff --git a/src/runtime/virtcontainers/utils/utils.go b/src/runtime/virtcontainers/utils/utils.go index 048446fd76..5a6bb71501 100644 --- a/src/runtime/virtcontainers/utils/utils.go +++ b/src/runtime/virtcontainers/utils/utils.go @@ -25,6 +25,11 @@ const cpBinaryName = "cp" const fileMode0755 = os.FileMode(0755) +// The DefaultRateLimiterRefillTime is used for calculating the rate at +// which a TokenBucket is replinished, in cases where a RateLimiter is +// applied to either network or disk I/O. +const DefaultRateLimiterRefillTimeMilliSecs = 1000 + // MibToBytesShift the number to shift needed to convert MiB to Bytes const MibToBytesShift = 20