class Kuroko2::MemoryConsumptionLog::Interval

Finally, maximum of interval will be 30 minutes.
then next interval will be 4 seconds then next interval will be 9 seconds.
First interval will be 1 second and next interval will be 1 second too,
As count becames greater, the interval period will be longer.

def current_length

1800, 1800, 1800, 1800, 1800, 1800, 1800, 1800]
961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764,
289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900,
[1, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256,

current_length mapping for count (0..50)
def current_length
  [[@count ** INCREMENT, INITIAL_INTERVAL_PERIOD].max, MAX_INTERVAL_PERIOD].min
end

def initialize(base_time, count = 0)

Parameters:
  • count (Integer) -- Throttled to be less than 50.
  • base_time (Time) --
def initialize(base_time, count = 0)
  @base_time = base_time
  @count = [count, 50].min
end

def next

Returns:
  • (MemoryConsumptionLog::Interval) -
def next
  self.class.new(Time.at(@base_time.to_i + current_length), @count.succ)
end

def reached?(now)

Returns:
  • (Boolean) -

Parameters:
  • now (Time) --
def reached?(now)
  (now - @base_time) > current_length
end