Fix logic error in periodic task wait code.

I was calculating the time to wait for the next run of a periodic
task incorrectly.

Resolves bug 1098819.

Change-Id: Ida60b69014aa06229111e58024e35268262f18fb
This commit is contained in:
Michael Still
2013-01-12 17:36:56 +11:00
parent 9282e0099d
commit 9bad998a17
2 changed files with 17 additions and 2 deletions

View File

@@ -215,8 +215,9 @@ class Manager(base.Base):
if self._periodic_spacing[task_name] is None:
wait = 0
else:
wait = time.time() - (self._periodic_last_run[task_name] +
self._periodic_spacing[task_name])
due = (self._periodic_last_run[task_name] +
self._periodic_spacing[task_name])
wait = max(0, due - time.time())
if wait > 0.2:
if wait < idle_for:
idle_for = wait