From fb80c4b859c6a7c0667b7ab75081ade9d3943e6c Mon Sep 17 00:00:00 2001 From: "simon@Simon-PC.lindenlab.com" Date: Tue, 18 Sep 2012 15:08:15 -0700 Subject: MAINT-1580 - Viewer shows "Unknown Notification" message on startup. Reviewed by Kelly --- indra/newview/llnotificationstorage.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'indra/newview/llnotificationstorage.cpp') diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index fb1adc7ddf..4df2a79b61 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -164,21 +164,29 @@ void LLPersistentNotificationStorage::loadNotifications() ++notification_it) { LLSD notification_params = *notification_it; - LLNotificationPtr notification(new LLNotification(notification_params)); - LLNotificationResponderPtr responder(LLResponderRegistry:: - createResponder(notification_params["name"], notification_params["responder"])); - notification->setResponseFunctor(responder); + if (instance.templateExists(notification_params["name"].asString())) + { + LLNotificationPtr notification(new LLNotification(notification_params)); + + LLNotificationResponderPtr responder(LLResponderRegistry:: + createResponder(notification_params["name"], notification_params["responder"])); + notification->setResponseFunctor(responder); - instance.add(notification); + instance.add(notification); - // hide script floaters so they don't confuse the user and don't overlap startup toast - LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false); + // hide script floaters so they don't confuse the user and don't overlap startup toast + LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false); - if(notification_channel) + if(notification_channel) + { + // hide saved toasts so they don't confuse the user + notification_channel->hideToast(notification->getID()); + } + } + else { - // hide saved toasts so they don't confuse the user - notification_channel->hideToast(notification->getID()); + llwarns << "Failed to find template for persistent notification " << notification_params["name"].asString() << llendl; } } } -- cgit v1.2.3 From c6a5b62152ec81b3b01f5c5cf2142178bea30ad8 Mon Sep 17 00:00:00 2001 From: Kelly Washington Date: Wed, 26 Sep 2012 14:40:16 -0700 Subject: MAINT-994 Oskar Linden login issues * Set max persistent notifications to 250 * Don't register for notification callbacks until after peristent ones are loaded. reviewed with Simon --- indra/newview/llnotificationstorage.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'indra/newview/llnotificationstorage.cpp') diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index 4df2a79b61..4cad96fdc7 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -84,6 +84,11 @@ bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& pay return false; } +// Storing or loading too many persistent notifications will severely hurt +// viewer load times, possibly to the point of failing to log in. Example case +// from MAINT-994 is 821 notifications. +static const S32 MAX_PERSISTENT_NOTIFICATIONS = 250; + void LLPersistentNotificationStorage::saveNotifications() { // TODO - think about save optimization. @@ -114,6 +119,13 @@ void LLPersistentNotificationStorage::saveNotifications() } data.append(notification->asLLSD()); + + if (data.size() >= MAX_PERSISTENT_NOTIFICATIONS) + { + llwarns << "Too many persistent notifications." + << " Saved " << MAX_PERSISTENT_NOTIFICATIONS << " of " << history_channel->size() << " persistent notifications." << llendl; + break; + } } LLPointer formatter = new LLSDXMLFormatter(); @@ -124,9 +136,6 @@ void LLPersistentNotificationStorage::loadNotifications() { LLResponderRegistry::registerResponders(); - LLNotifications::instance().getChannel("Persistent")-> - connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1)); - llifstream notify_file(mFileName.c_str()); if (!notify_file.is_open()) { @@ -158,7 +167,7 @@ void LLPersistentNotificationStorage::loadNotifications() findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); LLNotifications& instance = LLNotifications::instance(); - + S32 processed_notifications = 0; for (LLSD::array_const_iterator notification_it = data.beginArray(); notification_it != data.endArray(); ++notification_it) @@ -188,7 +197,18 @@ void LLPersistentNotificationStorage::loadNotifications() { llwarns << "Failed to find template for persistent notification " << notification_params["name"].asString() << llendl; } + + ++processed_notifications; + if (processed_notifications >= MAX_PERSISTENT_NOTIFICATIONS) + { + llwarns << "Too many persistent notifications." + << " Processed " << MAX_PERSISTENT_NOTIFICATIONS << " of " << data.size() << " persistent notifications." << llendl; + break; + } } + + LLNotifications::instance().getChannel("Persistent")-> + connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1)); } ////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3