Skip to content

Commit 64ad289

Browse files
authored
fix(scheduler): async get non-stream response to avoid block other re… (#269)
1 parent 0fd3c2c commit 64ad289

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/backend/server/request_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ async def stream_generator():
146146
return resp
147147
else:
148148
response = stub.chat_completion(request_data)
149-
response = next(response).decode()
149+
content = (await anext(iterate_in_threadpool(response))).decode()
150150
logger.debug(f"Non-stream response completed for {request_id}")
151151
# response is a JSON string; parse to Python object before returning
152-
return JSONResponse(content=json.loads(response))
152+
return JSONResponse(content=json.loads(content))
153153
except Exception as e:
154154
logger.exception(f"Error in _forward_request: {e}")
155155
return JSONResponse(

0 commit comments

Comments
 (0)