git-hulk commented on code in PR #2903:
URL: https://github.com/apache/kvrocks/pull/2903#discussion_r2077392652


##########
src/stats/log_collector.cc:
##########
@@ -89,6 +101,35 @@ void LogCollector<T>::PushEntry(std::unique_ptr<T> &&entry) 
{
   entries_.push_front(std::move(entry));
 }
 
+template <>
+void LogCollector<SlowEntry>::PushEntry(std::unique_ptr<SlowEntry> &&entry) {
+  std::lock_guard<std::mutex> guard(mu_);
+  entry->id = ++id_;
+  entry->time = util::GetTimeStamp();
+  if (max_entries_ > 0 && !entries_.empty() && entries_.size() >= 
static_cast<size_t>(max_entries_)) {
+    entries_.pop_back();
+  }

Review Comment:
   I think we could remove the duplicate code like this commit: 
https://github.com/git-hulk/kvrocks/commit/382b06f2f8bb1a44633de0d8da5d0a144c257440



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to