Cleanup dead handlers in ml moderation cron.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 16 Dec 2010 20:06:53 +0000 (21:06 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 16 Dec 2010 20:06:53 +0000 (21:06 +0100)
This should avoid manual actions when a temporary error occurred while
processing the moderation requests.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
bin/cron/cron_ml_moderate.php

index c6d22a6..c4d16b5 100755 (executable)
@@ -26,6 +26,11 @@ ini_set('memory_limit', '128M');
 $sent_mails = 0;
 $handler    = time();
 
+/* Cleanup dead locks */
+XDB::execute('UPDATE  email_list_moderate
+                 SET  handler = NULL
+               WHERE  handler < NOW() - 300');
+
 while ($sent_mails < $globals->lists->max_mail_per_min
        && time() - $handler < 60) {
     // take a lock on a mail