2
0
mirror of https://opendev.org/x/pyghmi synced 2025-08-09 04:40:15 +00:00

Reduce instances of duplicate login

While XCC is aggressive about expiring tokens, sometimes it isn't.

In such a case, throw a logout request to the 'stale' session in case it
isn't to avoid consuming too many session slots.

Change-Id: I01819786755d5d5d29014c58d4dcbe5468c63607
This commit is contained in:
Jarrod Johnson
2020-03-20 09:20:01 -04:00
parent ec4b503edb
commit 59f44fa9c8

View File

@@ -372,6 +372,10 @@ class IMMClient(object):
def wc(self):
if (not self._wc or (self._wc.vintage and
self._wc.vintage < util._monotonic_time() - 30)):
if not self.updating and self._wc:
# in case the existing session is still valid
# dispose of the session
self.weblogout()
self._wc = self.get_webclient()
return self._wc