Skip to content

Commit

Permalink
fix: network statistic input bytes is not right in some case(OpenAtom…
Browse files Browse the repository at this point in the history
…Foundation#2223) (OpenAtomFoundation#2224)

Co-authored-by: liuchengyu <liuchengyu@360.cn>
  • Loading branch information
chengyu-l and liuchengyu authored Dec 20, 2023
1 parent 6ac145d commit 110d227
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 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,7 @@ 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 110d227

Please sign in to comment.