Merge "polling: run polling tasks immediately on start"

This commit is contained in:
Zuul 2017-11-24 18:38:57 +00:00 committed by Gerrit Code Review
commit 2bf957ea07
1 changed files with 3 additions and 4 deletions

View File

@ -50,7 +50,7 @@ OPTS = [
'throughput at the cost of load set this to False.'),
cfg.FloatOpt('shuffle_time_before_polling_task',
min=0,
default=0,
default=10,
help='To reduce large requests at same time to Nova or other '
'components from different compute agents, shuffle '
'start time of polling task.'),
@ -379,13 +379,12 @@ class AgentManager(cotyledon.Service):
futures.ThreadPoolExecutor(max_workers=len(data)))
for interval, polling_task in data.items():
delay_time = interval + delay_polling_time
@periodics.periodic(spacing=interval, run_immediately=False)
@periodics.periodic(spacing=interval, run_immediately=True)
def task(running_task):
self.interval_task(running_task)
utils.spawn_thread(utils.delayed, delay_time,
utils.spawn_thread(utils.delayed, delay_polling_time,
self.polling_periodics.add, task, polling_task)
utils.spawn_thread(self.polling_periodics.start, allow_empty=True)