From 59f44fa9c882d42cd73c2f4ebe02ea93cb4584dd Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 20 Mar 2020 09:20:01 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/oem/lenovo/imm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 27143193..92bdaced 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -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