Class: Kato::Instance
- Inherits:
-
Object
- Object
- Kato::Instance
- Defined in:
- lib/kato/pool_manager.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_busy_interval ⇒ Object
Returns the value of attribute last_busy_interval.
-
#last_idle_interval ⇒ Object
Returns the value of attribute last_idle_interval.
-
#last_report_time ⇒ Object
Returns the value of attribute last_report_time.
-
#load_estimate ⇒ Object
Returns the value of attribute load_estimate.
-
#minimum_lifetime_in_minutes ⇒ Object
Returns the value of attribute minimum_lifetime_in_minutes.
-
#startup_time ⇒ Object
Returns the value of attribute startup_time.
Instance Method Summary collapse
-
#initialize(id, minimum_lifetime_in_minutes = 55) ⇒ Instance
constructor
A new instance of Instance.
- #minimum_lifetime_elapsed? ⇒ Boolean
- #update_load ⇒ Object
Constructor Details
#initialize(id, minimum_lifetime_in_minutes = 55) ⇒ Instance
Returns a new instance of Instance.
218 219 220 221 222 223 224 225 226 |
# File 'lib/kato/pool_manager.rb', line 218 def initialize(id, minimum_lifetime_in_minutes = 55) @id = id @minimum_lifetime_in_minutes = minimum_lifetime_in_minutes @load_estimate = 0 @last_idle_interval = 0 @last_busy_interval = 0 @last_report_time = Time.now @startup_time = Time.now end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
216 217 218 |
# File 'lib/kato/pool_manager.rb', line 216 def id @id end |
#last_busy_interval ⇒ Object
Returns the value of attribute last_busy_interval.
216 217 218 |
# File 'lib/kato/pool_manager.rb', line 216 def last_busy_interval @last_busy_interval end |
#last_idle_interval ⇒ Object
Returns the value of attribute last_idle_interval.
216 217 218 |
# File 'lib/kato/pool_manager.rb', line 216 def last_idle_interval @last_idle_interval end |
#last_report_time ⇒ Object
Returns the value of attribute last_report_time.
216 217 218 |
# File 'lib/kato/pool_manager.rb', line 216 def last_report_time @last_report_time end |
#load_estimate ⇒ Object
Returns the value of attribute load_estimate.
216 217 218 |
# File 'lib/kato/pool_manager.rb', line 216 def load_estimate @load_estimate end |
#minimum_lifetime_in_minutes ⇒ Object
Returns the value of attribute minimum_lifetime_in_minutes.
216 217 218 |
# File 'lib/kato/pool_manager.rb', line 216 def minimum_lifetime_in_minutes @minimum_lifetime_in_minutes end |
#startup_time ⇒ Object
Returns the value of attribute startup_time.
216 217 218 |
# File 'lib/kato/pool_manager.rb', line 216 def startup_time @startup_time end |
Instance Method Details
#minimum_lifetime_elapsed? ⇒ Boolean
232 233 234 |
# File 'lib/kato/pool_manager.rb', line 232 def minimum_lifetime_elapsed? (Time.now - startup_time) > (minimum_lifetime_in_minutes * 60) end |
#update_load ⇒ Object
228 229 230 |
# File 'lib/kato/pool_manager.rb', line 228 def update_load @load_estimate = (last_busy_interval.to_i / (last_idle_interval.to_i + last_busy_interval.to_i).to_f * 100) end |