Class: Necropsy::Analyzers::Dynamic::RedisDeadline

Inherits:
Object
  • Object
show all
Defined in:
lib/necropsy/analyzers/dynamic/redis_input_limits.rb

Instance Method Summary collapse

Constructor Details

#initialize(seconds) ⇒ RedisDeadline

Returns a new instance of RedisDeadline.



71
72
73
# File 'lib/necropsy/analyzers/dynamic/redis_input_limits.rb', line 71

def initialize(seconds)
  @expires_at = monotonic_time + seconds
end

Instance Method Details

#check!Object



82
83
84
85
# File 'lib/necropsy/analyzers/dynamic/redis_input_limits.rb', line 82

def check!
  remaining
  nil
end

#remainingObject

Raises:



75
76
77
78
79
80
# File 'lib/necropsy/analyzers/dynamic/redis_input_limits.rb', line 75

def remaining
  seconds = @expires_at - monotonic_time
  raise Error, 'Redis total timeout exceeded' unless seconds.positive?

  seconds
end