Merge "fix metricd workers" into stable/1.3

This commit is contained in:
Jenkins 2016-02-01 20:57:05 +00:00 committed by Gerrit Code Review
commit 2c66a687d1
1 changed files with 10 additions and 7 deletions

View File

@ -71,13 +71,17 @@ class MetricProcessBase(multiprocessing.Process):
while True:
try:
with timeutils.StopWatch() as timer:
self.store.process_background_tasks(self.index)
self._run_job()
time.sleep(max(0, self.interval_delay - timer.elapsed()))
except KeyboardInterrupt:
# Ignore KeyboardInterrupt so parent handler can kill
# all children.
pass
@staticmethod
def _run_job():
raise NotImplementedError
class MetricReporting(MetricProcessBase):
def _run_job(self):
@ -93,12 +97,11 @@ class MetricReporting(MetricProcessBase):
class MetricProcessor(MetricProcessBase):
def _run_job(self):
LOG.debug("Processing new measures")
try:
self.store.process_measures(self.index)
except Exception:
LOG.error("Unexpected error during measures processing",
exc_info=True)
try:
self.store.process_background_tasks(self.index)
except Exception:
LOG.error("Unexpected error during measures processing",
exc_info=True)
def metricd():