Skip to content

Commit

Permalink
chore: comments
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Gershman <[email protected]>
  • Loading branch information
romange committed Jun 9, 2024
1 parent 84aa1e6 commit 875ddcd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/facade/dragonfly_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void Connection::OnConnectionStart() {
}

void Connection::HandleRequests() {
VLOG(1) << "[" << id_ << "HandleRequests";
VLOG(1) << "[" << id_ << "] HandleRequests";

if (absl::GetFlag(FLAGS_tcp_nodelay) && !socket_->IsUDS()) {
int val = 1;
Expand Down Expand Up @@ -975,7 +975,7 @@ void Connection::DispatchSingle(bool has_more, absl::FunctionRef<void()> invoke_
return;

// Prefer sending synchronous request if possible (can_dispatch_sync=false),
// to reduce the memory pressure.
// to reduce the memory pressure. `has_more` is just an o
has_more = false;
if (cc_->async_dispatch || !dispatch_q_.empty() || cc_->subscriptions > 0) {
can_dispatch_sync = false;
Expand Down Expand Up @@ -1392,15 +1392,16 @@ void Connection::ExecutionFiber(util::FiberSocketBase* peer) {

builder->SetBatchMode(dispatch_q_.size() > 1);

bool subscriber_over_limit =
stats_->dispatch_queue_subscriber_bytes >= queue_backpressure_->publish_buffer_limit;

// Special case: if the dispatch queue accumulated a big number of commands,
// we can try to squash them
// It is only enabled if the threshold is reached and the whole dispatch queue
// consists only of commands (no pubsub or monitor messages)
bool squashing_enabled = squashing_threshold > 0;
bool threshold_reached = pending_pipeline_cmd_cnt_ > squashing_threshold;
bool are_all_plain_cmds = pending_pipeline_cmd_cnt_ == dispatch_q_.size();
bool subscriber_over_limit =
stats_->dispatch_queue_subscriber_bytes >= queue_backpressure_->publish_buffer_limit;
if (squashing_enabled && threshold_reached && are_all_plain_cmds && !skip_next_squashing_) {
SquashPipeline(builder);
} else {
Expand Down

0 comments on commit 875ddcd

Please sign in to comment.