Skip to content

Commit

Permalink
Merge pull request #43864 from yaarith/fix-config-notify
Browse files Browse the repository at this point in the history
mgr/telemetry: fix waiting for mgr to warm up

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
yuriw committed Dec 13, 2021
2 parents 6d5c4e0 + fa5cc0c commit 6adb612
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pybind/mgr/telemetry/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.last_report: Dict[str, Any] = dict()
self.report_id: Optional[str] = None
self.salt: Optional[str] = None
self.config_update_module_option()
# for mypy which does not run the code
if TYPE_CHECKING:
self.url = ''
Expand All @@ -156,12 +157,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.channel_device = True
self.channel_perf = False

def config_notify(self) -> None:
def config_update_module_option(self) -> None:
for opt in self.MODULE_OPTIONS:
setattr(self,
opt['name'],
self.get_module_option(opt['name']))
self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name']))

def config_notify(self) -> None:
self.config_update_module_option()
# wake up serve() thread
self.event.set()

Expand Down Expand Up @@ -1111,11 +1115,10 @@ def refresh_health_checks(self) -> None:

def serve(self) -> None:
self.load()
self.config_notify()
self.run = True

self.log.debug('Waiting for mgr to warm up')
self.event.wait(10)
time.sleep(10)

while self.run:
self.event.clear()
Expand Down

0 comments on commit 6adb612

Please sign in to comment.