2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-28 11:57:34 +00:00

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
This commit is contained in:
Jarrod Johnson 2018-08-15 13:58:07 -04:00
parent 6a85c24b16
commit cc7b2cf2c0

View File

@ -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