I’m finding that it is not easy to create a campaign that will send out a limited number of emails per MAILQUEUE_BATCH_PERIOD so that I can slowly send out a campaign over a longer period of time, like a month.
In the following experiment I’m trying to spread out the sending of only 6 emails over 3 hours. I know this can be done simply by setting how many emails to send per batch period, but this won’t work if you want to send only between say 9 to 5 pm and pick up the next day between 9-5. So I tried an experiment:
For example, let’s say we have a cron that fires off every half-hour. Let’s further say our MAILQUEUE_BATCH_SIZE is 2 (this is an experiment) and MAILQUEUE_BATCH_PERIOD is 55 minutes and MAX_PROCESSQUEUE_TIME is 50 minutes. For this experiment only 6 emails are included in the list. According to how MAX_PROCESSQUEUE_TIME works, processqueue should stop at 50 minutes (and it does as I’ve examined the processes on the server and it dies right at the mark), and the next cron job at the half hour mark should start the process over again.
My tests have shown the first cron job firing off the processqueue goes as expected and 2 emails are sent in the first 50 minutes. However, subsequent crons produce a report that seems to indicate that phplist processqueue goes back and calculates how many emails were sent in the last sending period and then deducts that amount from the next-up cron job so that instead of 2 emails going out only 1 does. See the messages below:
At 2:30 the Cron fires off and the emails are running and out of the gate.
At 3:20 pm (50 minutes after cron fires) phplist has done exactly what it is supposed to do: sends out 2 emails in 50 minutes, so at 3:20 sending stops. And the following confirmation message is received:
[Wed 25 Jul 2018 14:30] [CL] Started
[Wed 25 Jul 2018 14:30] [CL] Sending in batches of 2 emails
[Wed 25 Jul 2018 14:30] [CL] Processing has started,
[Wed 25 Jul 2018 14:30] [CL] One campaign to process.
[Wed 25 Jul 2018 14:30] [CL] Processing campaign 3
[Wed 25 Jul 2018 14:30] [CL] Looking for subscribers
[Wed 25 Jul 2018 14:30] [CL] Found them: 6 to process
[Wed 25 Jul 2018 15:20] [CL] batch limit reached: 2 (2)
[Wed 25 Jul 2018 15:20] [CL] Script stage: 5
[Wed 25 Jul 2018 15:20] [CL] 2 messages sent in 3000.02 seconds (2 msgs/hr)
Now, at 3:30 pm the cron job runs again and 2 emails are supposed to go out this period, but only 1 does with the following message:
[Wed 25 Jul 2018 15:30] [CL] Started
[Wed 25 Jul 2018 15:30] [CL] Sending in batches of 2 messages
[Wed 25 Jul 2018 15:30] [CL] This batch will be 1 emails, because in the last 3,000 seconds 1 emails were sent <------- problem here.
[Wed 25 Jul 2018 15:30] [CL] Processing has started,
[Wed 25 Jul 2018 15:30] [CL] One campaign to process.
[Wed 25 Jul 2018 15:30] [CL] Processing campaign 3
[Wed 25 Jul 2018 15:30] [CL] Looking for subscribers
[Wed 25 Jul 2018 15:30] [CL] Found them: 4 to process
[Wed 25 Jul 2018 15:55] [CL] batch limit reached: 1 (1)
[Wed 25 Jul 2018 15:55] [CL] Script stage: 5
[Wed 25 Jul 2018 15:55] [CL] 1 messages sent in 1500.00 seconds (2 msgs/hr)
It would seem to me that processqueue should not look back and calcualte how many were previously sent if the purpose MAX_PROCESSQUEUE_TIME is to kill the proecessqueue and start from scratch. See the definition of MAX_PROCESSQUEUE_TIME, below.
// MAX_PROCESSQUEUE_TIME
// to limit the time, regardless of batch processing or other throttling of a single run of “processqueue”
// you can set the MAX_PROCESSQUEUE_TIME in seconds
// if a single queue run exceeds this amount, it will stop, just to pick up from where it left off next time
// this allows multiple installations each to run the queue, but slow installations (eg with large emails)
// set to 0 to disable this feature.
define(‘MAX_PROCESSQUEUE_TIME’, 0);
Or maybe I’ve mis-configured something?