Skip to content

Commit

Permalink
Merge pull request #7 from notmatt/master
Browse files Browse the repository at this point in the history
Pagination termination condition
  • Loading branch information
mcavage committed Sep 9, 2011
2 parents 03eaf17 + 74de9aa commit 27719ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/cloudapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ CloudAPI.prototype.countMachines = function(account, options, callback) {

var done = true;
if (headers['x-resource-count'] && headers['x-query-limit'])
done = (headers['x-resource-count'] < headers['x-query-limit']);
done = (parseInt(headers['x-resource-count'], 10) <
parseInt(headers['x-query-limit'], 10) + req.query.offset);

var count = +headers['x-resource-count'];

Expand Down Expand Up @@ -723,7 +724,7 @@ CloudAPI.prototype.listMachines = function(account, options, tags, callback) {
var done = true;
if (headers['x-resource-count'] && headers['x-query-limit'])
done = (parseInt(headers['x-resource-count'], 10) <
parseInt(headers['x-query-limit'], 10));
parseInt(headers['x-query-limit'], 10) + req.query.offset);

log.debug('CloudAPI._get(%s) -> err=%o, obj=%o, done=%s',
req.path, err, obj, done);
Expand Down

0 comments on commit 27719ad

Please sign in to comment.