Skip to content
Permalink
Browse files

Avoid short-looping the merge_hb_data on set_smon() always reporting …

…a change

Detect a value actually changed before flagging the monitor thread loop for
a fast re-run.
  • Loading branch information...
cvaroqui committed Jun 28, 2019
1 parent f10b109 commit ab0bafb5ec758955b209c6b8d6e71b7017f31573
Showing with 10 additions and 5 deletions.
  1. +10 −5 lib/osvcd_shared.py
@@ -435,6 +435,7 @@ def get_services_nodenames():

def set_nmon(self, status=None, local_expect=None, global_expect=None):
global NMON_DATA
changed = False
with NMON_DATA_LOCK:
if status:
if status != NMON_DATA.status:
@@ -444,8 +445,9 @@ def set_nmon(self, status=None, local_expect=None, global_expect=None):
NMON_DATA.status else "none",
status
)
NMON_DATA.status = status
NMON_DATA.status_updated = time.time()
changed = True
NMON_DATA.status = status
NMON_DATA.status_updated = time.time()

if local_expect:
if local_expect == "unset":
@@ -457,7 +459,8 @@ def set_nmon(self, status=None, local_expect=None, global_expect=None):
NMON_DATA.local_expect else "none",
local_expect
)
NMON_DATA.local_expect = local_expect
changed = True
NMON_DATA.local_expect = local_expect

if global_expect:
if global_expect == "unset":
@@ -469,9 +472,11 @@ def set_nmon(self, status=None, local_expect=None, global_expect=None):
NMON_DATA.global_expect else "none",
global_expect
)
NMON_DATA.global_expect = global_expect
changed = True
NMON_DATA.global_expect = global_expect

wake_monitor(reason="node mon change")
if changed:
wake_monitor(reason="node mon change")

def set_smon(self, svcpath, status=None, local_expect=None,
global_expect=None, reset_retries=False,

0 comments on commit ab0bafb

Please sign in to comment.
You can’t perform that action at this time.