mirror of
				https://github.com/xcat2/confluent.git
				synced 2025-11-03 21:02:36 +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:
		@@ -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 ''
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user