Fix certificate expiration scheduler
timedelta.seconds does not store the total seconds of a time span. Internally, seconds is the next smaller unit to days, hence timedelta.seconds will never exceed (or reach) the number of seconds in a day (60*60*24=86400)
This commit is contained in:
parent
ff28b0a005
commit
09bec1c4fe
1 changed files with 7 additions and 1 deletions
|
@ -901,9 +901,15 @@ class XMLStream(object):
|
|||
log.warn('CERT: Certificate has expired.')
|
||||
restart()
|
||||
|
||||
try:
|
||||
total_seconds = cert_ttl.total_seconds()
|
||||
except AttributeError:
|
||||
# for Python < 2.7
|
||||
total_seconds = (cert_ttl.microseconds + (cert_ttl.seconds + cert_ttl.days * 24 * 3600) * 10**6) / 10**6
|
||||
|
||||
log.info('CERT: Time until certificate expiration: %s' % cert_ttl)
|
||||
self.schedule('Certificate Expiration',
|
||||
cert_ttl.seconds,
|
||||
total_seconds,
|
||||
restart)
|
||||
|
||||
def _start_keepalive(self, event):
|
||||
|
|
Loading…
Reference in a new issue