Hello! We have installed phplist version 3.6.10 on our corporate server to manage our email campaigns. However, we are facing a problem where our tasks are freezing. If a campaign is created and is active, the automatic processing of the queue through cron works fine. However, if the script is run when there are no active campaigns, the processing outputs
(phpList - Maximum queue processing time: 1800 [0.0032670000] (146)
phpList - Recently sent : 0 phpList - Started [0.0031720000] (149)
phpList - Sending in groups with a number of emails - 500 [0.0004690000] (150)
phpList - select id from phplist_message where status not in (“draft”, “sent”, “prepared”, “suspended”) and embargo [0.0005140000] (151)
phpList - Script stage: 6 [0.0031040000] (155)
phpList - Completed, nothing to execute [0.0004960000] (156)
PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /var/www/html/lists/admin/actions/processqueue.php:262 Stack trace: #0 [internal function]: my_shutdown() #1 {main} thrown in /var/www/html/lists/admin/actions/processqueue.php on line 262 )
The database indicates that it remains in status 1. The next queue processes do not run until the record is manually deleted from the db.
Please tell me how to fix it.
@n.shutov This is the code that appears to be causing the error
$totaltime = $GLOBALS['processqueue_timer']->elapsed(1);
if ($totaltime > 0) {
$msgperhour = (3600 / $totaltime) * $counters['sent'];
} else {
$msgperhour = s('Calculating');
}
I’m not sure why a division by zero is happening but you can try to work around it by changing the line
if ($totaltime > 0) {
to
if ($totaltime > 0.5) {
so that statistics will be calculated only when the elapsed time is more than 0.5s (or any other value that you want to use).