diff options
| author | Rick Harris <rconradharris@gmail.com> | 2012-03-22 23:50:36 +0000 |
|---|---|---|
| committer | Rick Harris <rconradharris@gmail.com> | 2012-03-23 21:03:37 +0000 |
| commit | 8b3f327df03d2ca530d094342710ff3f75ae3934 (patch) | |
| tree | 9e8dd6e2e64420335372bcac6f4341978cf5a915 /nova/utils.py | |
| parent | 0b10c3f1a042003f917a4af95712a2d85561e53e (diff) | |
| download | nova-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.py | 7 |
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) |
