Commit f3a196e349b08ddb5f6ae888697322a291fc3fdb
1 parent
2cd4a3eb
Improve logging wrt to session expiration
Showing
1 changed file
with
13 additions
and
1 deletions
subscriptionstore.cpp
| @@ -654,10 +654,15 @@ void SubscriptionStore::removeExpiredSessionsClients() | @@ -654,10 +654,15 @@ void SubscriptionStore::removeExpiredSessionsClients() | ||
| 654 | logger->logf(LOG_DEBUG, "Cleaning out old sessions"); | 654 | logger->logf(LOG_DEBUG, "Cleaning out old sessions"); |
| 655 | 655 | ||
| 656 | const std::chrono::time_point<std::chrono::steady_clock> now = std::chrono::steady_clock::now(); | 656 | const std::chrono::time_point<std::chrono::steady_clock> now = std::chrono::steady_clock::now(); |
| 657 | + int removedSessions = 0; | ||
| 658 | + int processedRemovals = 0; | ||
| 659 | + int queuedRemovalsLeft = -1; | ||
| 657 | 660 | ||
| 658 | { | 661 | { |
| 659 | std::lock_guard<std::mutex>(this->queuedSessionRemovalsMutex); | 662 | std::lock_guard<std::mutex>(this->queuedSessionRemovalsMutex); |
| 660 | 663 | ||
| 664 | + queuedRemovalsLeft = queuedSessionRemovals.size(); | ||
| 665 | + | ||
| 661 | auto it = queuedSessionRemovals.begin(); | 666 | auto it = queuedSessionRemovals.begin(); |
| 662 | while (it != queuedSessionRemovals.end()) | 667 | while (it != queuedSessionRemovals.end()) |
| 663 | { | 668 | { |
| @@ -667,7 +672,6 @@ void SubscriptionStore::removeExpiredSessionsClients() | @@ -667,7 +672,6 @@ void SubscriptionStore::removeExpiredSessionsClients() | ||
| 667 | { | 672 | { |
| 668 | if (qsr.getExpiresAt() > now) | 673 | if (qsr.getExpiresAt() > now) |
| 669 | { | 674 | { |
| 670 | - logger->logf(LOG_DEBUG, "Breaking from sorted list of queued session removals. %d left in the future.", queuedSessionRemovals.size()); | ||
| 671 | break; | 675 | break; |
| 672 | } | 676 | } |
| 673 | 677 | ||
| @@ -675,12 +679,20 @@ void SubscriptionStore::removeExpiredSessionsClients() | @@ -675,12 +679,20 @@ void SubscriptionStore::removeExpiredSessionsClients() | ||
| 675 | if (!session->hasActiveClient()) | 679 | if (!session->hasActiveClient()) |
| 676 | { | 680 | { |
| 677 | removeSession(session); | 681 | removeSession(session); |
| 682 | + removedSessions++; | ||
| 678 | } | 683 | } |
| 679 | } | 684 | } |
| 680 | it = queuedSessionRemovals.erase(it); | 685 | it = queuedSessionRemovals.erase(it); |
| 686 | + | ||
| 687 | + processedRemovals++; | ||
| 681 | } | 688 | } |
| 689 | + | ||
| 690 | + queuedRemovalsLeft = queuedSessionRemovals.size(); | ||
| 682 | } | 691 | } |
| 683 | 692 | ||
| 693 | + logger->logf(LOG_DEBUG, "Processed %d queued session removals, resuling in %d deleted expired sessions. %d queued removals in the future.", | ||
| 694 | + processedRemovals, removedSessions, queuedRemovalsLeft); | ||
| 695 | + | ||
| 684 | if (lastTreeCleanup + std::chrono::minutes(30) < now) | 696 | if (lastTreeCleanup + std::chrono::minutes(30) < now) |
| 685 | { | 697 | { |
| 686 | RWLockGuard lock_guard(&subscriptionsRwlock); | 698 | RWLockGuard lock_guard(&subscriptionsRwlock); |