Force removal of group first wnen update is forced.

GitOrigin-RevId: 3f4f9027d705c23bf3494acfa0941eba5cfc2676
This commit is contained in:
levlam 2019-03-31 00:45:25 +03:00
parent bad2ee02a0
commit b8ca259418

View File

@ -1449,6 +1449,7 @@ void NotificationManager::flush_pending_notifications(NotificationGroupId group_
bool is_updated = final_group_key < last_group_key; bool is_updated = final_group_key < last_group_key;
bool force_update = false; bool force_update = false;
NotificationGroupId removed_group_id;
if (!is_updated) { if (!is_updated) {
CHECK(!was_updated); CHECK(!was_updated);
VLOG(notifications) << "There is no need to send updateNotificationGroup in " << group_key VLOG(notifications) << "There is no need to send updateNotificationGroup in " << group_key
@ -1462,6 +1463,7 @@ void NotificationManager::flush_pending_notifications(NotificationGroupId group_
if (!was_updated) { if (!was_updated) {
if (last_group_key.last_notification_date != 0) { if (last_group_key.last_notification_date != 0) {
// need to remove last notification group to not exceed max_notification_group_count_ // need to remove last notification group to not exceed max_notification_group_count_
removed_group_id = last_group_key.group_id;
send_remove_group_update(last_group_key, groups_[last_group_key], vector<int32>()); send_remove_group_update(last_group_key, groups_[last_group_key], vector<int32>());
} }
send_add_group_update(group_key, group); send_add_group_update(group_key, group);
@ -1502,7 +1504,10 @@ void NotificationManager::flush_pending_notifications(NotificationGroupId group_
add_group(std::move(final_group_key), std::move(group)); add_group(std::move(final_group_key), std::move(group));
if (force_update) { if (force_update) {
force_flush_pending_updates(group_key.group_id, "flush_pending_notifications"); if (removed_group_id.is_valid()) {
force_flush_pending_updates(removed_group_id, "flush_pending_notifications 1");
}
force_flush_pending_updates(group_key.group_id, "flush_pending_notifications 2");
} }
} }