Permalink
Browse files

Merge pull request #7 from notmatt/master

Pagination termination condition
  • Loading branch information...
2 parents 03eaf17 + 74de9aa commit 27719ad69bf235f6eb13074b7160b52cf7e05bb9 @mcavage mcavage committed Sep 9, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/cloudapi.js
View
@@ -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'];
@@ -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);

0 comments on commit 27719ad

Please sign in to comment.