Skip to content

Commit

Permalink
Merge pull request #484 from scality/bf/ZENKO-314-removeMongoCursorLimit
Browse files Browse the repository at this point in the history
bf: ZENKO-314 remove mongo cursor limit
  • Loading branch information
rahulreddy authored May 8, 2018
2 parents ef32d5e + 93a2a79 commit 843bd1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions lib/algos/list/delimiter.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
'use strict'; // eslint-disable-line strict

const Extension = require('./Extension').default;
const { checkLimit, inc, FILTER_END, FILTER_ACCEPT, FILTER_SKIP } =
require('./tools');
const MAX_KEYS_HARDLIMIT = 10000;
const { inc, FILTER_END, FILTER_ACCEPT, FILTER_SKIP } = require('./tools');

/**
* Find the next delimiter in the path
Expand Down Expand Up @@ -64,7 +62,6 @@ class Delimiter extends Extension {
this.prefix = parameters.prefix;
this.marker = parameters.marker;
this.maxKeys = parameters.maxKeys || 1000;
this.maxKeys = checkLimit(this.maxKeys, MAX_KEYS_HARDLIMIT);
this.alphabeticalOrder =
typeof parameters.alphabeticalOrder !== 'undefined' ?
parameters.alphabeticalOrder : true;
Expand Down
5 changes: 3 additions & 2 deletions lib/storage/metadata/mongoclient/readStream.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const Readable = require('stream').Readable;
const MongoUtils = require('./utils');
const MAX_KEYS_HARDLIMIT = 10000;

class MongoReadStream extends Readable {
constructor(c, options, searchOptions) {
Expand Down Expand Up @@ -67,7 +66,9 @@ class MongoReadStream extends Readable {
this._cursor = c.find(query).sort({
_id: options.reverse ? -1 : 1,
});
this._cursor = this._cursor.limit(MAX_KEYS_HARDLIMIT);
if (options.limit && options.limit !== -1) {
this._cursor = this._cursor.limit(options.limit);
}
this._options = options;
this._destroyed = false;
this.on('end', this._cleanup.bind(this));
Expand Down

0 comments on commit 843bd1f

Please sign in to comment.