Fetch data immediately after starting from a stored snapshot
Run get_all just after init finishes, without the initial wait for snapshot_interval seconds. Change-Id: Id7a09d2243ab72b4bf55dce8351690134ef4ca6d
This commit is contained in:
parent
db5b77b7eb
commit
007f937568
@ -65,7 +65,7 @@ class VitrageGraphInit(object):
|
||||
self._start_from_scratch()
|
||||
self.workers.submit_read_db_graph()
|
||||
self.workers.submit_start_evaluations()
|
||||
self._init_finale()
|
||||
self._init_finale(immediate_get_all=True if graph_snapshot else False)
|
||||
|
||||
def _restart_from_stored_graph(self, graph_snapshot):
|
||||
LOG.info('Main process - loading graph from database snapshot (%sKb)',
|
||||
@ -86,9 +86,9 @@ class VitrageGraphInit(object):
|
||||
self.driver_exec.snapshot_get_all()
|
||||
LOG.info("%s vertices loaded", self.graph.num_vertices())
|
||||
|
||||
def _init_finale(self):
|
||||
def _init_finale(self, immediate_get_all):
|
||||
self._add_graph_subscriptions()
|
||||
self.scheduler.start_periodic_tasks()
|
||||
self.scheduler.start_periodic_tasks(immediate_get_all)
|
||||
LOG.info('Init Finished')
|
||||
self.events_coordination.start()
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Scheduler(object):
|
||||
self.consistency = ConsistencyEnforcer(conf, graph)
|
||||
self.periodic = None
|
||||
|
||||
def start_periodic_tasks(self):
|
||||
def start_periodic_tasks(self, immediate_get_all):
|
||||
thread_num = len(utils.get_pull_drivers_names(self.conf))
|
||||
thread_num += 2 # for consistency and get_all
|
||||
self.periodic = periodics.PeriodicWorker.create(
|
||||
@ -45,7 +45,7 @@ class Scheduler(object):
|
||||
max_workers=thread_num))
|
||||
|
||||
self._add_consistency_timer()
|
||||
self._add_datasource_timers()
|
||||
self._add_datasource_timers(immediate_get_all)
|
||||
spawn(self.periodic.start)
|
||||
|
||||
def _add_consistency_timer(self):
|
||||
@ -61,10 +61,10 @@ class Scheduler(object):
|
||||
self.periodic.add(consistency_periodic)
|
||||
LOG.info("added consistency_periodic (spacing=%s)", spacing)
|
||||
|
||||
def _add_datasource_timers(self):
|
||||
def _add_datasource_timers(self, run_immediately):
|
||||
spacing = self.conf.datasources.snapshots_interval
|
||||
|
||||
@periodics.periodic(spacing=spacing)
|
||||
@periodics.periodic(spacing=spacing, run_immediately=run_immediately)
|
||||
def get_all_periodic():
|
||||
self.driver_exec.snapshot_get_all(DatasourceAction.SNAPSHOT)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user