support for abort without crash on disconnect
This commit is contained in:
parent
aed05e5565
commit
c2f675133d
1 changed files with 4 additions and 0 deletions
|
@ -583,6 +583,10 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
await asyncio.gather(*tasks)
|
||||
generate_result = generate_task.result()
|
||||
return generate_result
|
||||
except ConnectionAbortedError as cae: # attempt to abort if connection lost
|
||||
print(cae)
|
||||
handle.abort_generate()
|
||||
time.sleep(0.1) #short delay
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue