Module: Healthcheck
- Included in:
- LoadBalancer::Algo
- Defined in:
- lib/multi_dbs_load_balancer/healthcheck.rb
Instance Method Summary collapse
- #db_available?(db_index) ⇒ Boolean
- #mark_db_down(db_index) ⇒ Object
- #mark_redis_down ⇒ Object
- #redis_available? ⇒ Boolean
Instance Method Details
#db_available?(db_index) ⇒ Boolean
16 17 18 |
# File 'lib/multi_dbs_load_balancer/healthcheck.rb', line 16 def db_available?(db_index) db_down_times[db_index] < Time.now.to_i end |
#mark_db_down(db_index) ⇒ Object
12 13 14 |
# File 'lib/multi_dbs_load_balancer/healthcheck.rb', line 12 def mark_db_down(db_index) db_down_times[db_index] = Time.now.to_i + LoadBalancer.db_down_time end |
#mark_redis_down ⇒ Object
4 5 6 |
# File 'lib/multi_dbs_load_balancer/healthcheck.rb', line 4 def mark_redis_down set_redis_down_time(Time.now.to_i + LoadBalancer.redis_down_time) end |
#redis_available? ⇒ Boolean
8 9 10 |
# File 'lib/multi_dbs_load_balancer/healthcheck.rb', line 8 def redis_available? @redis.present? && redis_down_time < Time.now.to_i end |