fixed a race condition with SSE streaming

This commit is contained in:
Concedo 2023-10-20 22:01:09 +08:00
parent 5f5d5f1d86
commit 6fa681b692
3 changed files with 17 additions and 14 deletions

View file

@ -365,7 +365,7 @@ maxhordelen = 256
modelbusy = threading.Lock()
requestsinqueue = 0
defaultport = 5001
KcppVersion = "1.47"
KcppVersion = "1.47.1"
showdebug = True
showsamplerwarning = True
showmaxctxwarning = True
@ -527,6 +527,7 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
current_token = 0
incomplete_token_buffer = bytearray()
await asyncio.sleep(0.1) #anti race condition, prevent check from overtaking generate
while True:
streamDone = handle.has_finished() #exit next loop on done
tokenStr = ""