func (c *RateBucketCounter) IncrBy(val int64) error {
	c.lock.Lock()
	defer c.lock.Unlock()

	curTimeShard := c.timer.UnixNano() / c.resolution
	bucketNo := curTimeShard % int64(len(c.buckets))

	if c.buckets[bucketNo].timeShard == 0 || curTimeShard-c.buckets[bucketNo].timeShard >= c.period/c.resolution {
		c.buckets[bucketNo].value = 0
		c.buckets[bucketNo].timeShard = curTimeShard
	}

	c.buckets[bucketNo].value += val

	return nil
}
// IncrBy adds the given value to this counter
IncrBy adds the given value to this counter
// IncrBy adds the given value to this counter
func (c *RateBucketCounter) IncrBy(val int64) error {
	c.lock.Lock()
	defer c.lock.Unlock()
	curTimeShard := c.timer.UnixNano() / c.resolution
	bucketNo := curTimeShard % int64(len(c.buckets))
	if c.buckets[bucketNo].timeShard == 0 || curTimeShard-c.buckets[bucketNo].timeShard >= c.period/c.resolution {
		c.buckets[bucketNo].value = 0
		c.buckets[bucketNo].timeShard = curTimeShard
	}
	c.buckets[bucketNo].value += val
	return nil
}
func ( c * RateBucketCounter ) IncrBy ( val int64 ) error { c . lock . Lock ( ) defer c . lock . Unlock ( ) curTimeShard := c . timer . UnixNano ( ) / c . resolution bucketNo := curTimeShard % int64 ( len ( c . buckets ) ) if c . buckets [ bucketNo ] . timeShard == 0 || curTimeShard - c . buckets [ bucketNo ] . timeShard >= c . period / c . resolution { c . buckets [ bucketNo ] . value = 0 c . buckets [ bucketNo ] . timeShard = curTimeShard } c . buckets [ bucketNo ] . value += val return nil }
IncrBy adds the given value to this counter
IncrBy adds the given value to this counter