View Issue Details

IDProjectCategoryView StatusLast Update
0016765phplist applicationMessage Send Processpublic28-03-13 19:42
Reporterduncanc 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionSVN 
Target VersionFixed in Version2.11.8 
Summary0016765: process queue has incorrect units for sleeping
DescriptionWhen processing the message queue in a browser the browser window is being refreshed several times a second and records being written to the event log.

I think that this might be caused by the process sleeping for too short a period.
See file admin/actions/processqueue.php lines 227-236
====
      if ($sent + 10 < $GLOBALS["original_num_per_batch"]) {
        sleep(10); // wait 10 seconds
        output($GLOBALS['I18N']->get('Less than batch size were sent, so reloading imminently'),1,'progress');
        $delaytime = 10000;
      } else {
        output(sprintf($GLOBALS['I18N']->get('Waiting for %d seconds before reloading'),$batch_period),1,'progress');
        $delaytime = $batch_period * 1000;
      }
      //output("Do not reload this page yourself, because the next batch would fail");
      usleep($delaytime);
====
usleep expects its parameter to be in microseconds, but $delaytime is being calculated in milliseconds.

If the intention is to delay for either 10s or the batch period, then sleep() can be used whose units is seconds as there is no need to have microsecond accuracy.

Additionally, for the true part of the if statement, why is there a 10s sleep and then another sleep after the if statement?
TagsNo tags attached.

Activities

michiel

28-03-13 19:42

manager   ~0052001

good find!. I think the duplication was a leftover. The 10 seconds is just to avoid it reloading too often. But the usleep did that anyway.

changed to using sleep instead of usleep.