Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __try_renew(self):
try:
self.__eva.lock_renew()
except Exception:
raise EvaLockError("""'with eva:' context statements require a locked eva object, e.g. by using 'with eva.lock():',
and not unlocking from within the statement.""")
self.__try_renew()
self.__cond = threading.Condition()
self.__thread = threading.Thread(target=self.__renewal_timer)
self.__period_stack.append(self.__renew_period)
self.__thread.start()
else:
with self.__cond:
if self.__renew_period != self.__period_stack[-1]:
self.__try_renew()
self.__period_stack.append(self.__renew_period)
self.__reset_timer()
else:
raise EvaLockError("""Unneccesary refresh of the lock renewal process,
lock is already being renewed with the configured period.""")