Forums | Mahara Community
Broken elastic search triggers
03 May 2019, 11:50 AM
Already a few people had this issue, so it's worth explaining a possible solution we've found. We are working on removing the elastic search triggers from the DB on Mahara, but while we work on this you might find the following lines helpful.
Basically, there are a few cron jobs that need to drop the triggers before working on the DB. When they finish they have to create the triggers again. But it could happen that the drop and create operation are clashing when called by some cron jobs. One could try to create them when the previous create operation didn't finish.
For example those that runs every half an hour could clash with those that run every 5 minutes, like the 'user_login_tries_to_zero'.
The cron jobs that need to drop the triggers are the following
and you can find the times they run defined in the 'cron' table on the DB.
A solution to prevent them from trying to work on the elasticsearch triggers at the same time, without giving the other job enough time to finish working on them, is to define an offset of 2 or 3 minutes in their run time.
On the DB, for the cron job that runs every 5 minutes, we can add an offset like this:
update cron set minute='2-59/5' where callfunction = 'user_login_tries_to_zero';
So the 'user_login_tries_to_zero' it would run at 2,7,12,17,.. minutes of the hour.
I you had this problem and the triggers on the DB are broken, you might find the information here useful too.