2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-29 12:27:40 +00:00

Ensure correct inflight thread id is discarded

It seems it is possible in some circumstance for the thread id to become stale,
perhaps due to a different threadid executing the code for some reason.
Just in case, ensure the same exact value that was added is later discarded.
This commit is contained in:
Jarrod Johnson 2016-03-05 15:47:49 -05:00
parent 8bf7a55b68
commit b98889b54a

View File

@ -422,15 +422,15 @@ def resourcehandler_backend(env, start_response):
# add our thread to the 'inflight' to have a hook to terminate
# a long polling request
loggedout = None
httpsessions[authorized['sessionid']]['inflight'].add(
greenlet.getcurrent())
mythreadid = greenlet.getcurrent()
httpsessions[authorized['sessionid']]['inflight'].add(mythreadid)
try:
outdata = consolesessions[sessid]['session'].get_next_output(
timeout=25)
except greenlet.GreenletExit as ge:
loggedout = ge
httpsessions[authorized['sessionid']]['inflight'].discard(
greenlet.getcurrent())
mythreadid)
if sessid not in consolesessions:
start_response('400 Expired Session', headers)
yield ''