diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index 39041d67c..9ce681b89 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -652,7 +652,9 @@ void NotificationManager::try_reuse_notification_group_id(NotificationGroupId gr auto group_it = get_group(group_id); if (group_it != groups_.end()) { CHECK(group_it->first.last_notification_date == 0); - CHECK(group_it->second.total_count == 0); + LOG_CHECK(group_it->second.total_count == 0) + << running_get_difference_ << " " << pending_notification_update_count_ << " " + << pending_updates_[group_id.get()].size() << " " << group_it->first << " " << group_it->second; CHECK(group_it->second.notifications.empty()); CHECK(group_it->second.pending_notifications.empty()); CHECK(!group_it->second.is_being_loaded_from_database); diff --git a/td/telegram/NotificationManager.h b/td/telegram/NotificationManager.h index 3ceba6499..a5f243117 100644 --- a/td/telegram/NotificationManager.h +++ b/td/telegram/NotificationManager.h @@ -25,6 +25,7 @@ #include "td/utils/logging.h" #include "td/utils/Status.h" #include "td/utils/StringBuilder.h" +#include "td/utils/Time.h" #include #include @@ -140,6 +141,13 @@ class NotificationManager : public Actor { bool is_silent = false; NotificationId notification_id; unique_ptr type; + + friend StringBuilder &operator<<(StringBuilder &string_builder, const PendingNotification &pending_notification) { + return string_builder << "PendingNotification[" << pending_notification.notification_id << " of type " + << pending_notification.type << " sent at " << pending_notification.date + << " with settings from " << pending_notification.settings_dialog_id + << ", is_silent = " << pending_notification.is_silent << "]"; + } }; struct NotificationGroup { @@ -152,6 +160,16 @@ class NotificationManager : public Actor { double pending_notifications_flush_time = 0; vector pending_notifications; + + friend StringBuilder &operator<<(StringBuilder &string_builder, const NotificationGroup ¬ification_group) { + return string_builder << "NotificationGroup[" << notification_group.type << " with total " + << notification_group.total_count << " notifications " << notification_group.notifications + << " + " << notification_group.pending_notifications + << ", is_loaded_from_database = " << notification_group.is_loaded_from_database + << ", is_being_loaded_from_database = " << notification_group.is_being_loaded_from_database + << ", pending_notifications_flush_time = " + << notification_group.pending_notifications_flush_time << ", now = " << Time::now() << "]"; + } }; enum class SyncState : int32 { NotSynced, Pending, Completed }; diff --git a/td/telegram/NotificationType.h b/td/telegram/NotificationType.h index ace632309..9a62e31e3 100644 --- a/td/telegram/NotificationType.h +++ b/td/telegram/NotificationType.h @@ -46,6 +46,13 @@ inline StringBuilder &operator<<(StringBuilder &string_builder, const Notificati return notification_type.to_string_builder(string_builder); } +inline StringBuilder &operator<<(StringBuilder &string_builder, const unique_ptr ¬ification_type) { + if (notification_type == nullptr) { + return string_builder << "null"; + } + return string_builder << *notification_type; +} + unique_ptr create_new_message_notification(MessageId message_id); unique_ptr create_new_secret_chat_notification();