From cc7b2cf2c0033436a2d12093239c6ce1d6e79d38 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 15 Aug 2018 13:58:07 -0400 Subject: [PATCH] Forget sessions with poor connectivity that should be forgotten The only way for a registered waiter for general IO activity to be forgotten was for it to be satisfied. Unfortunately, in a bad scenario, it would sit and be relatively worthless. In a large environment, this could accrue and those stubbed out events become a large headache. Change-Id: I1e2c7afa1dc5c9e2adeb26f2e4cd7a7b7b9709ed --- pyghmi/ipmi/private/session.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 395adcb4..afbfc83f 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -124,12 +124,15 @@ def define_worker(): # deadline if they still have time waiting, or # if they have expired, wake them now to let them # process their timeout - for w in directediowaiters[d]: + for idx, w in enumerate(list(directediowaiters[d])): ltimeout = w[0] - _monotonic_time() if ltimeout < 0: w[1].set() # time is up, wake the caller + del directediowaiters[d][idx] elif ltimeout < timeout: timeout = ltimeout + if not directediowaiters[d]: + del directediowaiters[d] while ioqueue: workitem = ioqueue.popleft() # order: function, args, list to append to , event to set