Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Wrap last chunk aggregate flag with atomic.
Kishore Nallana8a8c60e0f19
diff --git a/include/http_data.h b/include/http_data.hindex ff575bb6..7190c8f1 100644--- a/include/http_data.h+++ b/include/http_data.h@@ -196,7 +196,7 @@ struct http_req {std::map<std::string, std::string> params;bool first_chunk_aggregate;- bool last_chunk_aggregate;+ std::atomic<bool> last_chunk_aggregate;size_t chunk_len;std::string body;@@ -311,7 +311,7 @@ struct http_req {content["route_hash"] = route_hash;content["params"] = params;content["first_chunk_aggregate"] = first_chunk_aggregate;- content["last_chunk_aggregate"] = last_chunk_aggregate;+ content["last_chunk_aggregate"] = last_chunk_aggregate.load();content["body"] = body;content["metadata"] = metadata;content["start_ts"] = start_ts;diff --git a/src/http_server.cpp b/src/http_server.cppindex 5105091e..b7c3a6d7 100644--- a/src/http_server.cpp+++ b/src/http_server.cpp@@ -875,6 +875,8 @@ bool HttpServer::on_stream_response_message(void *data) {bool HttpServer::on_request_proceed_message(void *data) {//LOG(INFO) << "on_request_proceed_message";+ // This callback will run concurrently to batch indexer's run() so care must be taken to protect access+ // to variables that are written to by the batch indexer, which for now is only: last_chunk_aggregate (atomic)deferred_req_res_t* req_res = static_cast<deferred_req_res_t *>(data);auto stream_state = (req_res->req->last_chunk_aggregate) ? H2O_SEND_STATE_FINAL : H2O_SEND_STATE_IN_PROGRESS;