Unread notification count is too slow

Bug #854403 reported by Richard Mansfield
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Richard Mansfield

Bug Description

Fetching the count of unread notifications to sit next to the envelope in the header is expensive on postgres, because notification_internal_activity is the biggest table. It's also rather unnecessary, so we should add an option to remove the count, and at the same time use a different envelope icon whenever the user has more than one unread notification.

Changed in mahara:
assignee: nobody → Richard Mansfield (richard-mansfield)
importance: Undecided → Medium
milestone: none → 1.5.0
status: New → In Progress
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/716
Committed: http://gitorious.org/mahara/mahara/commit/8b4933e1805f17985edafb5dff343e13026c986f
Submitter: Richard Mansfield (<email address hidden>)
Branch: master

commit 8b4933e1805f17985edafb5dff343e13026c986f
Author: Richard Mansfield <email address hidden>
Date: Fri Sep 16 13:50:14 2011 +1200

    Remove unread message count from profile sideblock (bug #854403)

    This has been unnecessary for some time now, because the same count
    appears next to the envelope in the top right of the header.

    Change-Id: I14581f8edff19ee5111eba4ff4ec8f564ad2443a
    Signed-off-by: Richard Mansfield <email address hidden>

Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Richard Mansfield (richard-mansfield) wrote : Re: Remove unread notification count from top right header

Not done yet, just removed from the profile sideblock.

Changed in mahara:
status: Fix Committed → In Progress
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/870
Committed: http://gitorious.org/mahara/mahara/commit/4b3117e421cea1252d2c36d9104d16abb37237e4
Submitter: Richard Mansfield (<email address hidden>)
Branch: master

commit 4b3117e421cea1252d2c36d9104d16abb37237e4
Author: Richard Mansfield <email address hidden>
Date: Tue Nov 15 11:04:30 2011 +1300

    Add column for unread message counts to the usr table (bug #854403)

    The unread message counts are expensive to query in postgres when
    notification_internal_activity gets big. This results in very slow
    logins (the first time the query is run). This patch adds a new
    column for each user to store the unread message count.

    The counts are updated using a trigger on insert, update and delete
    of the notification_internal_activity table.

    Change-Id: Ifb24c6892567658584f45825437bb7a8f20cc310
    Signed-off-by: Richard Mansfield <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/871
Committed: http://gitorious.org/mahara/mahara/commit/60167828f1fa2d1e225dd61099fcc2915ebe8a90
Submitter: Richard Mansfield (<email address hidden>)
Branch: master

commit 60167828f1fa2d1e225dd61099fcc2915ebe8a90
Author: Richard Mansfield <email address hidden>
Date: Tue Nov 15 11:10:22 2011 +1300

    Get unread message count from user table (bug #854403)

    Also keeps the count in the $USER object up to date whenever the
    user deletes or reads a notification.

    When new notifications are generated for a live user by another user,
    or on cron, the logged-in user's unread count is reloaded from the
    database into the session either on hitting the inbox, or whenever
    $USER is committed for some other reason.

    The code to reload the background fields on commit of the LiveUser
    object has been changed to ensure that it still works at upgrade time,
    where the 'reload' column doesn't exist in the user table yet, but
    *does* exist in the User object.

    Change-Id: I9c9a81bf77d0927352902dee0d989d6122757b47
    Signed-off-by: Richard Mansfield <email address hidden>

Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

Rather than removing the unread message count from the header, these patches keep track of that number along with each user, so displaying the count should be faster.

summary: - Remove unread notification count from top right header
+ Unread notification count is too slow
Changed in mahara:
status: In Progress → Fix Committed
Melissa Draper (melissa)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.