Avoid warning when time taken is close to zero

We use "%(delay).2f" to print the time taken so even
if the delay is say 0.001, we will still print the
warning. We should just round it off till the 2nd place
to avoid odd looking lines that say:

run outlasted interval by 0.00 sec

Change-Id: I7137eb7ad985d7f35adc62a65ad1218a39a7a959
This commit is contained in:
Davanum Srinivas 2015-12-02 19:51:03 -05:00
parent 5c927520e0
commit d47ca1277f
1 changed files with 1 additions and 1 deletions

View File

@ -169,7 +169,7 @@ class FixedIntervalLoopingCall(LoopingCallBase):
def start(self, interval, initial_delay=None, stop_on_exception=True):
def _idle_for(result, elapsed):
delay = elapsed - interval
delay = round(elapsed - interval, 2)
if delay > 0:
func_name = reflection.get_callable_name(self.f)
LOG.warning(_LW('Function %(func_name)r run outlasted '