2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 19:40:12 +00:00

Assure console sessions get reaped

When an error (to be fixed) happened while updating expiry,
an asyncsession failed to have a reaper scheduled for cleanup.
Correct this by putting the reaper schedule right after the
cancellation.

Further, an async being destroyed did not reap related console
sessions.  Add code to reap related console sessions when
the async session gets destroyed.
This commit is contained in:
Jarrod Johnson 2016-03-26 10:26:17 -04:00
parent 79b1268a75
commit 03b2cdab5a

View File

@ -104,6 +104,9 @@ class AsyncSession(object):
if self._evt:
self._evt.send()
self._evt = None
for console in self.consoles:
_consolesessions[console]['session'].destroy()
self.consoles = None
del _asyncsessions[self.asyncid]
def run_handler(self, handler, requestid):
@ -113,10 +116,10 @@ class AsyncSession(object):
def get_responses(self, timeout=25):
self.reaper.cancel()
self.reaper = eventlet.spawn_after(timeout + 15, self.destroy)
nextexpiry = time.time() + 90
for csess in self.consoles:
_consolesessions[csess]['expiry'] = nextexpiry
self.reaper = eventlet.spawn_after(timeout + 15, self.destroy)
if self._evt:
# TODO(jjohnson2): This precludes the goal of 'double barreled'
# access.... revisit if this could matter