Skip to content

Commit

Permalink
[status_manager] Fix legacy health manager: Thread executors need sta…
Browse files Browse the repository at this point in the history
…tic method
  • Loading branch information
BenjaminLudwigSAP committed Aug 3, 2022
1 parent 5d12376 commit edf5dec
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions octavia_f5/controller/statusmanager/status_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def __exit__(self, exc_type, exc_val, exc_tb):
with excutils.save_and_reraise_exception():
self._lock_session.rollback()

def update_health(msg):
LOG.info("Updating health")
update_db.UpdateHealthDb().update_health(msg, '127.0.0.1')

def update_stats(msg):
LOG.info("Updating stats")
update_db.UpdateStatsDb().update_stats(msg, '127.0.0.1')

class StatusManager(object):
def __init__(self):
LOG.info('Health Manager starting.')
Expand All @@ -70,8 +78,6 @@ def __init__(self):
self.listener_repo = repo.ListenerRepository()
self.amp_health_repo = repo.AmphoraHealthRepository()
self.lb_repo = repo.LoadBalancerRepository()
self.db_health_updater = update_db.UpdateHealthDb
self.db_stats_updater = update_db.UpdateStatsDb
self.health_executor = futurist.ThreadPoolExecutor(
max_workers=CONF.health_manager.health_update_threads)
self.stats_executor = futurist.ThreadPoolExecutor(
Expand Down Expand Up @@ -306,8 +312,8 @@ def _get_lb_msg(lb_id):

for msg in amphora_messages.values():
msg['recv_time'] = time.time()
self.health_executor.submit(self.db_health_updater.update_health, msg)
self.stats_executor.submit(self.db_stats_updater.update_stats, msg)
self.health_executor.submit(update_health, msg)
self.stats_executor.submit(update_stats, msg)

def update_listener_count(self, num_listeners):
""" updates listener count of bigip device (vrrp_priority column in amphora table)
Expand Down

0 comments on commit edf5dec

Please sign in to comment.