Healthmanager health_check timer config fix

The periodics health_check job was reading its timing config before
oslo.config had actually loaded real values, so it would always use the
default. Now it sets up the periodic at runtime, which loads the real
config value.

Change-Id: I85c6ff0e698c6c5899c78f8c3a5b119e80bb972a
This commit is contained in:
Adam Harwell 2018-01-12 15:40:55 -08:00
parent ab45b15c27
commit 4dc1f63df2
2 changed files with 10 additions and 6 deletions

View File

@ -18,7 +18,7 @@ import os
import signal
import sys
from futurist.periodics import PeriodicWorker
from futurist import periodics
from oslo_config import cfg
from oslo_log import log as logging
@ -47,8 +47,15 @@ def hm_listener(exit_event):
def hm_health_check(exit_event):
hm = health_manager.HealthManager(exit_event)
health_check = PeriodicWorker([(hm.health_check, None, None)],
schedule_strategy='aligned_last_finished')
@periodics.periodic(CONF.health_manager.health_check_interval,
run_immediately=True)
def periodic_health_check():
hm.health_check()
health_check = periodics.PeriodicWorker(
[(periodic_health_check, None, None)],
schedule_strategy='aligned_last_finished')
def hm_exit(*args, **kwargs):
health_check.stop()

View File

@ -16,7 +16,6 @@
from concurrent import futures
import functools
from futurist import periodics
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_log import log as logging
@ -62,8 +61,6 @@ class HealthManager(object):
self.amp_health_repo = repo.AmphoraHealthRepository()
self.dead = exit_event
@periodics.periodic(CONF.health_manager.health_check_interval,
run_immediately=True)
def health_check(self):
stats = {
'failover_attempted': 0,