reading tasks in chunks of 100, to keep memory down for huge infologs

This commit is contained in:
Ralf Becker 2016-06-25 10:53:50 +02:00
parent 814955bf4d
commit fe1b9d729c

View File

@ -210,12 +210,15 @@ class infolog_zpush implements activesync_plugin_write
); );
$messagelist = array(); $messagelist = array();
if (($infologs =& $this->infolog->search($filter))) // reading tasks in chunks of 100, to keep memory down for huge infologs
$filter['num_rows'] = 100;
for($filter['start']=0; ($infologs = $this->infolog->search($filter)); $filter['start'] += $filter['num_rows'])
{ {
foreach($infologs as $infolog) foreach($infologs as $infolog)
{ {
$messagelist[] = $this->StatMessage($id, $infolog); $messagelist[] = $this->StatMessage($id, $infolog);
} }
if (count($infologs) < $filter['num_rows']) break;
} }
//error_log(__METHOD__."('$id', $cutoffdate) filter=".array2string($filter)." returning ".count($messagelist).' entries'); //error_log(__METHOD__."('$id', $cutoffdate) filter=".array2string($filter)." returning ".count($messagelist).' entries');
return $messagelist; return $messagelist;