diff options
author | Kelly Washington <kelly@lindenlab.com> | 2012-09-26 14:40:16 -0700 |
---|---|---|
committer | Kelly Washington <kelly@lindenlab.com> | 2012-09-26 14:40:16 -0700 |
commit | c6a5b62152ec81b3b01f5c5cf2142178bea30ad8 (patch) | |
tree | f520120a5d31ce538d003953468bb994ceeee250 | |
parent | adce92282bd190f97b377512ce76fe375e0f115a (diff) |
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
-rw-r--r-- | indra/llui/llnotifications.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llnotifications.h | 1 | ||||
-rw-r--r-- | indra/newview/llnotificationhandlerutil.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llnotificationstorage.cpp | 28 |
4 files changed, 32 insertions, 5 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 629eef2c3b..f449800ffd 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1116,6 +1116,11 @@ bool LLNotificationChannel::isEmpty() const return mItems.empty(); } +S32 LLNotificationChannel::size() const +{ + return mItems.size(); +} + LLNotificationChannel::Iterator LLNotificationChannel::begin() { return mItems.begin(); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 4ae02b943f..d7534c416d 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -813,6 +813,7 @@ public: std::string getParentChannelName() { return mParent; } bool isEmpty() const; + S32 size() const; Iterator begin(); Iterator end(); diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 16c51138a9..34cb27d5ce 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -353,7 +353,8 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi if (from_id.isNull()) { - llwarns << " from_id for notification " << notification->getName() << " is null " << llendl; + // Normal behavior for system generated messages, don't spam. + // llwarns << " from_id for notification " << notification->getName() << " is null " << llendl; return; } 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<LLSDFormatter> 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)); } ////////////////////////////////////////////////////////////////////////// |