Class: Lhm::Throttler::Time
- Inherits:
-
Object
- Object
- Lhm::Throttler::Time
- Includes:
- Command, BackoffReduction
- Defined in:
- lib/lhm/throttler/time.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_TIMEOUT =
0.1
- DEFAULT_STRIDE =
2_000
- DEFAULT_BACKOFF_REDUCTION_FACTOR =
20%
0.2
- MIN_STRIDE_SIZE =
1
Instance Attribute Summary collapse
-
#stride ⇒ Object
Returns the value of attribute stride.
-
#timeout_seconds ⇒ Object
Returns the value of attribute timeout_seconds.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options = {}) ⇒ Time
constructor
A new instance of Time.
Methods included from BackoffReduction
Methods included from Command
Constructor Details
#initialize(options = {}) ⇒ Time
Returns a new instance of Time.
15 16 17 18 19 20 |
# File 'lib/lhm/throttler/time.rb', line 15 def initialize( = {}) @timeout_seconds = [:delay] || DEFAULT_TIMEOUT @stride = [:stride] || DEFAULT_STRIDE super end |
Instance Attribute Details
#stride ⇒ Object
Returns the value of attribute stride.
13 14 15 |
# File 'lib/lhm/throttler/time.rb', line 13 def stride @stride end |
#timeout_seconds ⇒ Object
Returns the value of attribute timeout_seconds.
12 13 14 |
# File 'lib/lhm/throttler/time.rb', line 12 def timeout_seconds @timeout_seconds end |
Instance Method Details
#execute ⇒ Object
22 23 24 |
# File 'lib/lhm/throttler/time.rb', line 22 def execute sleep timeout_seconds end |