apluslms / a-plus

A+ frontend portal - A+ LMS documentation:
https://apluslms.github.io/
Other
67 stars 72 forks source link

Notifications do not show up in the user interface #798

Closed markkuriekkinen closed 2 years ago

markkuriekkinen commented 3 years ago

After A+ v1.8, notifications have stopped working at least in the production A+ server. In local testing, the notifications are still working. This could imply that the issue is caused by the cache or cache configuration.

I have tested and verified that the notification rows are added to the notifications table in the database (in production). The seen attribute is false.

It is worth noting that A+ never deletes old notifications from the database. The production database contains over 50000 unnecessary old notifications. They could be removed.

Teacher's message:

We noticed that we're not (reliably) getting the normal notifications for received messages in the top menu of A+. We've tested with reviews from Rubyric, replies to feedback messages from MOOC-Jutut and (manual assistant) reviews to exercise submissions on A+.

Steps to reproduce:

One time I 'reviewed' a submission on A+, the notification and two earlier ones did appear for my student account, but I have not seen any since then for a few tests.

Internal ticket: https://rt.cs.aalto.fi/Ticket/Display.html?id=18169

markkuriekkinen commented 3 years ago

Relevant code:

markkuriekkinen commented 3 years ago

It is curious that sometimes the notification shows up in the UI like it should, but not every time. There are many recent notifications that have been shown to the user, but there are also many that have not been shown.

markkuriekkinen commented 3 years ago

New admin CLI command for deleting old notifications from the database: https://github.com/apluslms/a-plus/commit/fbed17c2ffcf6bd46a005264a50fdbe9bf961518

markkuriekkinen commented 3 years ago

I think that the code itself works OK, but if there are too many notifications, the cache stops working. The user interface can not show the notifications if they can not be read from the cache. Deleting old, unused notifications from the database alleviates the situation. It is still an open question what could be improved in the notifications cache so that it would work more reliably.

It is hard to specify what exactly goes wrong with the cache, but at least the cache has limited size for the whole cache and the individual item size. It might silently drop items that are too large.

markkuriekkinen commented 3 years ago

Django 3.2 LTS replaces the old Python Memcached API with a new library. I don't know if the new Memcached API/library could fix some problems in the cache.

markkuriekkinen commented 2 years ago

Closing. I assume that everything works if we regularly delete outdated notifications from the database so that the number of notifications does not increase all the time.