Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scottinet committed Nov 18, 2015
1 parent 9f165a2 commit a57af64
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/kuzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,8 @@ function cleanQueue () {
}
}

if (self.queueMaxSize > 0) {
if (self.offlineQueue.length >= self.queueMaxSize) {
self.offlineQueue.splice(0, self.offlineQueue.length - self.queueMaxSize);
}
if (self.queueMaxSize > 0 && self.offlineQueue.length > self.queueMaxSize) {
self.offlineQueue.splice(0, self.offlineQueue.length - self.queueMaxSize);
}
}

Expand Down Expand Up @@ -455,7 +453,7 @@ Kuzzle.prototype.getStatistics = function (timestamp, options, cb) {
timestamp = null;
} else {
cb = arguments[1];
if (arguments[0] === 'object') {
if (typeof arguments[0] === 'object') {
options = arguments[0];
timestamp = null;
} else {
Expand Down Expand Up @@ -553,7 +551,7 @@ Kuzzle.prototype.listCollections = function (options, cb) {

this.callbackRequired('Kuzzle.listCollections', cb);

this.query(null, 'read', 'listCollections', {}, function (err, res) {
this.query(null, 'read', 'listCollections', {}, options, function (err, res) {
if (err) {
return cb(err);
}
Expand Down Expand Up @@ -785,8 +783,8 @@ Kuzzle.prototype.setHeaders = function(content, replace) {
* Starts the requests queuing. Works only during offline mode, and if the autoQueue option is set to false.
*/
Kuzzle.prototype.startQueuing = function () {
if (self.state === 'offline' && !self.autoQueue) {
self.queuing = true;
if (this.state === 'offline' && !this.autoQueue) {
this.queuing = true;
}

return this;
Expand All @@ -796,8 +794,8 @@ Kuzzle.prototype.startQueuing = function () {
* Stops the requests queuing. Works only during offline mode, and if the autoQueue option is set to false.
*/
Kuzzle.prototype.stopQueuing = function () {
if (self.state === 'offline' && !self.autoQueue) {
self.queuing = false;
if (this.state === 'offline' && !this.autoQueue) {
this.queuing = false;
}

return this;
Expand Down

0 comments on commit a57af64

Please sign in to comment.