From fe1b9d729c9e99a1903e44eff350442d0b279de2 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 25 Jun 2016 10:53:50 +0200 Subject: [PATCH] reading tasks in chunks of 100, to keep memory down for huge infologs --- infolog/inc/class.infolog_zpush.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/infolog/inc/class.infolog_zpush.inc.php b/infolog/inc/class.infolog_zpush.inc.php index 26e4e974e0..c7d8dd4384 100644 --- a/infolog/inc/class.infolog_zpush.inc.php +++ b/infolog/inc/class.infolog_zpush.inc.php @@ -210,12 +210,15 @@ class infolog_zpush implements activesync_plugin_write ); $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) { $messagelist[] = $this->StatMessage($id, $infolog); } + if (count($infologs) < $filter['num_rows']) break; } //error_log(__METHOD__."('$id', $cutoffdate) filter=".array2string($filter)." returning ".count($messagelist).' entries'); return $messagelist;