mirror of
https://github.com/typesense/typesense.git
synced 2025-05-22 14:55:26 +08:00
Fix follower streaming edge case.
This commit is contained in:
parent
952b83f3a8
commit
9db05986d7
@ -225,7 +225,8 @@ size_t HttpClient::curl_write_async(char *buffer, size_t size, size_t nmemb, voi
|
||||
|
||||
//LOG(INFO) << "curl_write_async response, res body size: " << req_res->res->body.size();
|
||||
|
||||
req_res->server->get_message_dispatcher()->send_message(HttpServer::STREAM_RESPONSE_MESSAGE, req_res);
|
||||
async_req_res_t* async_req_res = new async_req_res_t(req_res->req, req_res->res, true);
|
||||
req_res->server->get_message_dispatcher()->send_message(HttpServer::STREAM_RESPONSE_MESSAGE, async_req_res);
|
||||
|
||||
// wait until response is sent
|
||||
//LOG(INFO) << "Waiting on req_res " << req_res->res;
|
||||
@ -247,7 +248,8 @@ size_t HttpClient::curl_write_async_done(void *context, curl_socket_t item) {
|
||||
req_res->res->body = "";
|
||||
req_res->res->final = true;
|
||||
|
||||
req_res->server->get_message_dispatcher()->send_message(HttpServer::STREAM_RESPONSE_MESSAGE, req_res);
|
||||
async_req_res_t* async_req_res = new async_req_res_t(req_res->req, req_res->res, true);
|
||||
req_res->server->get_message_dispatcher()->send_message(HttpServer::STREAM_RESPONSE_MESSAGE, async_req_res);
|
||||
|
||||
// wait until final response is flushed or response object will be destroyed by caller
|
||||
req_res->res->wait();
|
||||
|
@ -740,8 +740,8 @@ void HttpServer::stream_response(stream_response_state_t& state) {
|
||||
h2o_start_response(req, state.generator);
|
||||
}
|
||||
|
||||
if(state.res_body.len == 0) {
|
||||
// without this, http streaming will break
|
||||
if(state.res_body.len == 0 && state.send_state != H2O_SEND_STATE_FINAL) {
|
||||
// without this guard, http streaming will break
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user