Hi, we at work are running our site's cron via script instead of wget to avoid timeouts.

I recently discovered that sendmail was only sending 100 mails per cron, instead of the thousand we configured. It was executing just one batch each time, and then break execution with the message:

"""
Sending interrupted: PHP maximum execution time almost exceeded. Remaining newsletters will be sent during the next cron run. If this warning occurs regularly you should reduce the cron_throttle_setting.
"""

I looked at the module code and found this issue (line 300 simplemail.mail.inc):

if ($elapsed > SIMPLENEWS_SEND_TIME_LIMIT * $max_execution_time) {
          watchdog('simplenews', 'Sending interrupted: PHP maximum execution time almost exceeded. Remaining newsletters will be sent during the next cron run. If this warning occurs regularly you should reduce the !cron_throttle_setting.', array('!cron_throttle_setting' => l(t('Cron throttle setting'), 'admin/settings/simplenews/mail')), WATCHDOG_WARNING);
          break;
}

Well, the problem here is that the php client hardcodes the max_execution_time setting, deactivating it with a 0.

It's not being checked in the code, so it should be something like this:

if ($max_execution_time && $elapsed > SIMPLENEWS_SEND_TIME_LIMIT * $max_execution_time) {
          watchdog('simplenews', 'Sending interrupted: PHP maximum execution time almost exceeded. Remaining newsletters will be sent during the next cron run. If this warning occurs regularly you should reduce the !cron_throttle_setting.', array('!cron_throttle_setting' => l(t('Cron throttle setting'), 'admin/settings/simplenews/mail')), WATCHDOG_WARNING);
          break;
}
CommentFileSizeAuthor
#3 simplenews.admin_.patch966 bytescarlescliment

Comments

carlescliment’s picture

Title: Problem when running cron from script » Undesired timeout when running cron from script
miro_dietiker’s picture

Right. This should be corrected.

Could you please check 6.x-2.x and 7.x if this is still an issue?

carlescliment’s picture

StatusFileSize
new966 bytes

Patch

miro_dietiker’s picture

Version: 6.x-1.3 » 6.x-2.x-dev
Status: Active » Fixed

Applied to 6.x-2.x...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.