Skip to content

Commit d291ae3

Browse files
committed
added break condition for high limits
This will add a break condition to while loop for high limits, if the last data set is retrieved from redmine
1 parent 574b199 commit d291ae3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Redmine/Api/AbstractApi.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ protected function retrieveAll($endpoint, array $params = array())
121121
$newDataSet = (array) $this->get($endpoint . '?' . http_build_query($params));
122122
$ret = array_merge_recursive($ret, $newDataSet);
123123
$offset += $_limit;
124+
// Break if the data set is the last one, as the offset is greater
125+
// than the total count
126+
if ($newDataSet['offset'] >= $newDataSet['total_count']) {
127+
$limit = 0;
128+
}
124129
}
125130

126131
return $ret;

0 commit comments

Comments
 (0)