Skip to content

Commit

Permalink
fix: network statistic input bytes is not right in some case(#2223)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengyu committed Dec 20, 2023
1 parent 47c3c4a commit 7196788
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/net/src/redis_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ ReadStatus RedisConn::GetRequest() {
}

nread = read(fd(), rbuf_ + next_read_pos, remain);
g_network_statistic->IncrRedisInputBytes(nread);
if (nread == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
nread = 0;
Expand All @@ -100,6 +99,9 @@ ReadStatus RedisConn::GetRequest() {
// client closed, close client
return kReadClose;
}

g_network_statistic->IncrRedisInputBytes(nread);

// assert(nread > 0);
last_read_pos_ += static_cast<int32_t>(nread);
msg_peak_ = last_read_pos_;
Expand Down

0 comments on commit 7196788

Please sign in to comment.