summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorRick Harris <rconradharris@gmail.com>2012-03-22 23:50:36 +0000
committerRick Harris <rconradharris@gmail.com>2012-03-23 21:03:37 +0000
commit8b3f327df03d2ca530d094342710ff3f75ae3934 (patch)
tree9e8dd6e2e64420335372bcac6f4341978cf5a915 /nova/utils.py
parent0b10c3f1a042003f917a4af95712a2d85561e53e (diff)
downloadnova-8b3f327df03d2ca530d094342710ff3f75ae3934.tar.gz
nova-8b3f327df03d2ca530d094342710ff3f75ae3934.tar.xz
nova-8b3f327df03d2ca530d094342710ff3f75ae3934.zip
Add periodic_fuzzy_delay option.
Fixes bug 962665 This random delay is intended to reduce the stampeding behavior associated with periodic tasks when compute workers are restarted in unison across a cluster. Change-Id: Ie3771d94af29049061c129b8ea562ee447a61771
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 819929a81..29df28cea 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -687,13 +687,14 @@ class LoopingCall(object):
self.f = f
self._running = False
- def start(self, interval, now=True):
+ def start(self, interval, initial_delay=None):
self._running = True
done = event.Event()
def _inner():
- if not now:
- greenthread.sleep(interval)
+ if initial_delay:
+ greenthread.sleep(initial_delay)
+
try:
while self._running:
self.f(*self.args, **self.kw)