prevent ZeroDivisionError

This commit is contained in:
Jens Langhammer 2019-03-21 15:05:04 +01:00
parent 3a52059793
commit 801b8a1e59
1 changed files with 2 additions and 2 deletions

View File

@ -91,12 +91,12 @@ class PolicyEngine:
kwargs=kwargs, kwargs=kwargs,
time_limit=policy.timeout)) time_limit=policy.timeout))
self.__get_timeout += policy.timeout self.__get_timeout += policy.timeout
self.__get_timeout += 3
self.__get_timeout = (self.__get_timeout / len(self.policies)) * 1.5
LOGGER.debug("Set total policy timeout to %r", self.__get_timeout) LOGGER.debug("Set total policy timeout to %r", self.__get_timeout)
# If all policies are cached, we have an empty list here. # If all policies are cached, we have an empty list here.
if signatures: if signatures:
self.__group = group(signatures)() self.__group = group(signatures)()
self.__get_timeout += 3
self.__get_timeout = (self.__get_timeout / len(self.policies)) * 1.5
self.__cached = cached_policies self.__cached = cached_policies
return self return self