[core] Fix session reuse not checking if expiry is after now

Since total_seconds() just returns a positive number with the difference
we have to make sure we're actually still before the expiry time.
This commit is contained in:
derrod 2020-04-17 11:35:39 +02:00
parent 82163754ae
commit ce28ce2914
2 changed files with 2 additions and 2 deletions

View file

@ -1,3 +1,3 @@
"""Legendary!"""
__version__ = '0.0.1'
__version__ = '0.0.2'

View file

@ -98,7 +98,7 @@ class LegendaryCore:
td = dt_now - dt_old
# if session still has at least 10 minutes left we can re-use it.
if td.total_seconds() < (self.lgd.userdata['expires_in'] - 600):
if dt_old > dt_now and td.total_seconds() < (self.lgd.userdata['expires_in'] - 600):
self.log.debug('Reusing existing login session...')
self.egs.resume_session(self.lgd.userdata)
return True