mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 01:45:28 +00:00
[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:
parent
82163754ae
commit
ce28ce2914
|
@ -1,3 +1,3 @@
|
||||||
"""Legendary!"""
|
"""Legendary!"""
|
||||||
|
|
||||||
__version__ = '0.0.1'
|
__version__ = '0.0.2'
|
||||||
|
|
|
@ -98,7 +98,7 @@ class LegendaryCore:
|
||||||
td = dt_now - dt_old
|
td = dt_now - dt_old
|
||||||
|
|
||||||
# if session still has at least 10 minutes left we can re-use it.
|
# 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.log.debug('Reusing existing login session...')
|
||||||
self.egs.resume_session(self.lgd.userdata)
|
self.egs.resume_session(self.lgd.userdata)
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue