Don't update "arrow" on client-side for nothing

This commit is contained in:
Ivan Lezhankin 2019-02-07 16:47:16 +03:00
parent 8c640f54f8
commit 92769a2460
3 changed files with 15 additions and 3 deletions

2
.gitignore vendored
View File

@ -243,3 +243,5 @@ website/package-lock.json
# ccls cache # ccls cache
/.ccls-cache /.ccls-cache
/compile_commands.json

View File

@ -1031,7 +1031,8 @@ private:
// TODO: get the poll_interval from commandline. // TODO: get the poll_interval from commandline.
const auto receive_timeout = connection->getTimeouts().receive_timeout; const auto receive_timeout = connection->getTimeouts().receive_timeout;
constexpr size_t default_poll_interval = 1000000, min_poll_interval = 5000; /// in microseconds constexpr size_t default_poll_interval = 1000000; /// in microseconds
constexpr size_t min_poll_interval = 5000; /// in microseconds
const size_t poll_interval const size_t poll_interval
= std::max(min_poll_interval, std::min<size_t>(receive_timeout.totalMicroseconds(), default_poll_interval)); = std::max(min_poll_interval, std::min<size_t>(receive_timeout.totalMicroseconds(), default_poll_interval));
@ -1333,7 +1334,11 @@ private:
void onProgress(const Progress & value) void onProgress(const Progress & value)
{ {
progress.incrementPiecewiseAtomically(value); if (!progress.incrementPiecewiseAtomically(value))
{
// Just a keep-alive update.
return;
}
if (block_out_stream) if (block_out_stream)
block_out_stream->onProgress(value); block_out_stream->onProgress(value);
writeProgress(); writeProgress();

View File

@ -53,11 +53,16 @@ struct Progress
void writeJSON(WriteBuffer & out) const; void writeJSON(WriteBuffer & out) const;
/// Each value separately is changed atomically (but not whole object). /// Each value separately is changed atomically (but not whole object).
void incrementPiecewiseAtomically(const Progress & rhs) bool incrementPiecewiseAtomically(const Progress & rhs)
{ {
if (!rhs.rows)
return false;
rows += rhs.rows; rows += rhs.rows;
bytes += rhs.bytes; bytes += rhs.bytes;
total_rows += rhs.total_rows; total_rows += rhs.total_rows;
return true;
} }
void reset() void reset()