robogals / myrobogals

myRobogals is the global intranet and record-keeping tool for Robogals. It has been built to simplify many of our day-to-day tasks including organising school visits, maintaining a member database, communicating with members, storing records reliably for future generations and easily collecting statistics on a global scale.
https://my.robogals.org
10 stars 21 forks source link

Alert if the email cron job is not running properly #48

Closed U-238 closed 11 years ago

U-238 commented 11 years ago

In December last year, the email cron script was not running for several weeks. This meant that no emails from myRobogals were actually sent. Luckily, December is very quiet period for Robogals so the damage is not so bad.

My proposed fix to this is: superusers should see a warning banner when they use myRobogals, if there is an email still "pending" that should have been sent more than 3 hours ago. This would be an indicator that the cron job is not running, and the superuser can then do something about it.

yfcheung commented 11 years ago

Done.

if there is an email still "pending" that should have been sent more than 3 hours ago

email: EmailRecipient

manhinli commented 11 years ago

Current implementation buggy. Visually disabled at present.

yfcheung commented 11 years ago

can you develop more on the problems?

manhinli commented 11 years ago

I can't say definitively, because I thought the list was cleared, but apparently not. I'll come back.

manhinli commented 11 years ago

Yep, definitely something wrong. Ensured all records have status = 1 but didn't work, and triggered alert.

yfcheung commented 11 years ago

all records: 1: EmailMessage 2: EmailRecipient

(rgmessages/models.py)

which one is it?

manhinli commented 11 years ago

Argh. The way emails are handled is really unintuitive. Made loads of (un)commits.

However, there's statuses:

How do we handle those?

yfcheung commented 11 years ago

myrobogals/scripts/send_email_cron.php line: 112 to 158 and 167

summary: line 112 to 158, shows the code that stores statuses back to EmailRecipient line 167, shows the code that stores statuses back to EmailMessage

if all EmailRecipient's status is not zero for a particular EmailMessage, then that EmailMessage's status is set to 1.

Your questions: What are the further actions for EmailRecipients with status other than 1 and 0. The reality is "myrobogals/scripts/send_email_cron.php" does not do anything with them.

manhinli commented 11 years ago

I understand that, but does the scope of a "failed email" fall only under pending emails?

yfcheung commented 11 years ago

call me on skype

yfcheung commented 11 years ago

The definition I took is based on "myrobogals/scripts/send_email_cron.php", it is conceivable that other scripts take further actions to handle other kind of "failed email", in that case I am wrong. But I can not find other scripts that do this, somewhere in the repository, if you find them, let me know.

manhinli commented 11 years ago

Should be working. Closing.