Prevent a possible divide by 0 in obj/auditor.py.
Fixes bug 941731. If 'elapsed=0' in audit_all_objects set it to 0.000001 to avoid divide by 0. Change-Id: If0b43568033167818c482c8927863bea1dccfe57
This commit is contained in:
parent
6f7f95ffde
commit
72267260b1
@ -105,7 +105,8 @@ class AuditorWorker(object):
|
|||||||
self.errors = 0
|
self.errors = 0
|
||||||
self.bytes_processed = 0
|
self.bytes_processed = 0
|
||||||
time_auditing += (now - loop_time)
|
time_auditing += (now - loop_time)
|
||||||
elapsed = time.time() - begin
|
# Avoid divide by zero during very short runs
|
||||||
|
elapsed = (time.time() - begin) or 0.000001
|
||||||
self.logger.info(_(
|
self.logger.info(_(
|
||||||
'Object audit (%(type)s) "%(mode)s" mode '
|
'Object audit (%(type)s) "%(mode)s" mode '
|
||||||
'completed: %(elapsed).02fs. Total quarantined: %(quars)d, '
|
'completed: %(elapsed).02fs. Total quarantined: %(quars)d, '
|
||||||
|
Loading…
Reference in New Issue
Block a user