Improve TQueue::clear logging.

This commit is contained in:
levlam 2023-01-29 13:04:04 +03:00
parent 5666925e5b
commit f8372a52e3

View File

@ -247,6 +247,7 @@ class TQueueImpl final : public TQueue {
} }
} }
auto collect_deleted_event_ids_time = 0.0;
if (callback_ != nullptr) { if (callback_ != nullptr) {
vector<uint64> deleted_log_event_ids; vector<uint64> deleted_log_event_ids;
for (auto it = q.events.begin(); it != end_it; ++it) { for (auto it = q.events.begin(); it != end_it; ++it) {
@ -255,6 +256,7 @@ class TQueueImpl final : public TQueue {
deleted_log_event_ids.push_back(event.log_event_id); deleted_log_event_ids.push_back(event.log_event_id);
} }
} }
collect_deleted_event_ids_time = Time::now() - start_time;
for (auto log_event_id : deleted_log_event_ids) { for (auto log_event_id : deleted_log_event_ids) {
callback_->pop(log_event_id); callback_->pop(log_event_id);
} }
@ -284,7 +286,9 @@ class TQueueImpl final : public TQueue {
if (clear_time > 0.01) { if (clear_time > 0.01) {
LOG(WARNING) << "Cleared " << (size - keep_count) << " TQueue events with total size " LOG(WARNING) << "Cleared " << (size - keep_count) << " TQueue events with total size "
<< (total_event_length - q.total_event_length) << " in " << clear_time - callback_clear_time << (total_event_length - q.total_event_length) << " in " << clear_time - callback_clear_time
<< " seconds and deleted them from callback in " << callback_clear_time << " seconds"; << " seconds, collected their identifiers in " << collect_deleted_event_ids_time
<< " seconds, and deleted them from callback in "
<< callback_clear_time - collect_deleted_event_ids_time << " seconds";
} }
return deleted_events; return deleted_events;
} }