mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
Send X-ClickHouse-Progress header in the end of a query execution
This commit is contained in:
parent
cdc65eca23
commit
7a75003d26
@ -36,11 +36,24 @@ void WriteBufferFromHTTPServerResponse::startSendHeaders()
|
||||
}
|
||||
}
|
||||
|
||||
void WriteBufferFromHTTPServerResponse::writeHeaderProgress()
|
||||
{
|
||||
if (headers_finished_sending)
|
||||
return;
|
||||
|
||||
WriteBufferFromOwnString progress_string_writer;
|
||||
accumulated_progress.writeJSON(progress_string_writer);
|
||||
|
||||
#if defined(POCO_CLICKHOUSE_PATCH)
|
||||
*response_header_ostr << "X-ClickHouse-Progress: " << progress_string_writer.str() << "\r\n" << std::flush;
|
||||
#endif
|
||||
}
|
||||
|
||||
void WriteBufferFromHTTPServerResponse::finishSendHeaders()
|
||||
{
|
||||
if (!headers_finished_sending)
|
||||
{
|
||||
writeHeaderProgress();
|
||||
headers_finished_sending = true;
|
||||
|
||||
if (request.getMethod() != Poco::Net::HTTPRequest::HTTP_HEAD)
|
||||
@ -174,13 +187,7 @@ void WriteBufferFromHTTPServerResponse::onProgress(const Progress & progress)
|
||||
|
||||
/// Send all common headers before our special progress headers.
|
||||
startSendHeaders();
|
||||
|
||||
WriteBufferFromOwnString progress_string_writer;
|
||||
accumulated_progress.writeJSON(progress_string_writer);
|
||||
|
||||
#if defined(POCO_CLICKHOUSE_PATCH)
|
||||
*response_header_ostr << "X-ClickHouse-Progress: " << progress_string_writer.str() << "\r\n" << std::flush;
|
||||
#endif
|
||||
writeHeaderProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,9 @@ private:
|
||||
/// but not finish them with \r\n, allowing to send more headers subsequently.
|
||||
void startSendHeaders();
|
||||
|
||||
// Used for write the header X-ClickHouse-progress
|
||||
void writeHeaderProgress();
|
||||
|
||||
/// This method finish headers with \r\n, allowing to start to send body.
|
||||
void finishSendHeaders();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user