View Issue Details

IDProjectCategoryView StatusLast Update
0017290phplist applicationMessage Managementpublic06-07-15 17:04
Reporterduncanc 
PrioritynormalSeverityfeatureReproducibilitysometimes
Status resolvedResolutionfixed 
Product Version3.0.6 
Target Version3.1.XFixed in Version3.2.0 
Summary0017290: Requeuing a campaign does not have a predictable embargo time
DescriptionI used the requeue feature on a campaign with an interval of 60 minutes. The intention was to send a campaign to new subscribers as soon as possible after they
confirmed the subscription. My cron job runs every 10 minutes, and I had an unexpected result.

The campaign was being resent not every hour, but at either 1 hour 10 minutes, or 1 hour 20 minute intervals.

Looking at the file admin/actions/processqueue.php the processing to requeue the campaign occurs on the next run of processqueue after the campaign was marked as sent. That accounts for the first 10 minutes.
The second 10 minutes is I think a timing difference between the new embargo time, and the time that the cron job actually runs, meaning that sometimes the
campaign was not sent until a further run of the cron job.

Before looking at the help text for requeuing (which does explain this), I expected that the requeue interval would be applied to the embargo time, not to the time when the campaign finished sending.
In most cases the embargo time seems to make more sense as then the campaign will be requeued at a predictable time, such as requeue the campaign at 08:00 each morning.
The current processing is going to continually move that time forward by the cron job frequency.

I suggest a change to the processing logic to apply the requeue interval to the embargo time so that the campaign is then resent at a predictable time.

See the processing at line 454 of actions/processqueue.php

## check for messages that need requeueing
$req = Sql_Query(sprintf('select id,requeueinterval,embargo < now() as inthepast from %s where requeueinterval > 0 and requeueuntil > now() and status = "sent"',$tables['message']));
while ($msg = Sql_Fetch_Assoc($req)) {
  if ($msg['inthepast']) {
    Sql_query(sprintf('update %s set status = "submitted",sendstart = null, embargo = date_add(now(),interval %d minute) where id = %d',$GLOBALS['tables']['message'],$msg['requeueinterval'],$msg['id']));
  } else {
    Sql_query(sprintf('update %s set status = "submitted",sendstart = null, embargo = date_add(embargo,interval %d minute) where id = %d',$GLOBALS['tables']['message'],$msg['requeueinterval'],$msg['id']));
  }
  ## @@@ need to update message data as well
}

I'm not sure that I understand the "inthepast" test, as the embargo time should always be in the past if the message has a 'sent' status.

TagsConfiguration and sending

Activities

duncanc

12-03-15 17:28

developer   ~0055975

See GitHub pull request https://github.com/phpList/phplist3/pull/1