phplist

NOTE:: Before reporting an issue, make sure you are running the latest version, currently 3.3.1


View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015626phplist applicationBatch Processingpublic24-07-11 09:2018-05-15 18:37
Reporterduncanc 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version2.10.14 
Target VersionFixed in Version2.10.15 
Summary0015626: Autothrottle not delaying for the correct period
DescriptionThere was a post on the phplist forums about autothrottle not appearing to work
http://forums.phplist.com/viewtopic.php?f=24&t=36605 [^]

I've looked at the code within processqueue.php and it is delaying for an incorrect period. It calcuates the difference between the required messages/second and the actual messages/second and then delays for that * 1000000. Clearly this is wrong.

As the aim of autothrottle is to spread the sending of a batch evenly throughout the batch period, the code should be using target and actual elapsed times.
Attached is a patch to do this.
I have removed "$sent > 10" from the condition, as otherwise the message sending is not even. I have also changed the message output when verbose in enabled to more clearly reflect the time per message, rather than message rate. The original output message has been left in but commented out.

The patch replaces lines 688-708 inclusive of file admin/processqueue.php for release 2.10.14. That file is the same for release 2.10.13.
In release 2.11.6 there are some other changes to that file, so the affected lines are 839-859.
Additional InformationHere is the change to the code, also attached

           } elseif (MAILQUEUE_AUTOTHROTTLE
                 && MAILQUEUE_BATCH_SIZE && MAILQUEUE_BATCH_SIZE > 0 ) {
             $totaltime = $GLOBALS['processqueue_timer']->elapsed(1);
             $target = (MAILQUEUE_BATCH_PERIOD / MAILQUEUE_BATCH_SIZE) * $sent;
             $delay = $target - $totaltime;

             if ($delay > 0) {
               if (VERBOSE) {
/* output($GLOBALS['I18N']->get('waiting for').' '.$delay.' '.$GLOBALS['I18N']->get('seconds').' '.
                   $GLOBALS['I18N']->get('to make sure we don\'t exceed our limit of ').MAILQUEUE_BATCH_SIZE.' '.
                   $GLOBALS['I18N']->get('messages in ').' '.MAILQUEUE_BATCH_PERIOD.$GLOBALS['I18N']->get('seconds')); */
                output(sprintf($GLOBALS['I18N']->get('waiting for %.1f seconds to meet target of %s seconds per message'),
                        $delay, (MAILQUEUE_BATCH_PERIOD / MAILQUEUE_BATCH_SIZE)
                ));
               }
               usleep($delay * 1000000);
             }
           }
TagsNo tags attached.
Attached Filespatch file icon processqueue.php.patch [^] (1,010 bytes) 24-07-11 09:20 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0051388)
michiel (manager)
08-08-11 15:28

nice find!

http://phplist.svn.sourceforge.net/phplist/?rev=2796&view=rev [^]


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker