2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-17 02:58:51 +00:00

Tolerate terminal closure

When a terminal closes and notifies server, it was
pulling the rug out from asyncsession consoles.
Make asyncsession aware that the console may be gone
and discard tracking it rather than give a 500.
This commit is contained in:
Jarrod Johnson 2016-03-26 10:45:47 -04:00
parent 03b2cdab5a
commit 417e70e5c1

View File

@ -118,8 +118,11 @@ class AsyncSession(object):
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
for csess in list(self.consoles):
try:
_consolesessions[csess]['expiry'] = nextexpiry
except KeyError: # session has been closed elsewhere
self.consoles.discard(csess)
if self._evt:
# TODO(jjohnson2): This precludes the goal of 'double barreled'
# access.... revisit if this could matter