From 9e2bbe1072df90e30f915438cad0dcd727132c7c Mon Sep 17 00:00:00 2001 From: Patrick Mooney Date: Wed, 25 Jun 2014 14:38:26 -0500 Subject: [PATCH] Alter client queue parameters and error reporting - Use 'queueDisable' as option for disabling client RequestQueue - Throw more meaningful ConnectionError when enqueue fails --- lib/client/client.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/client/client.js b/lib/client/client.js index 15820ea..f5ec33b 100644 --- a/lib/client/client.js +++ b/lib/client/client.js @@ -202,12 +202,11 @@ function Client(options) { }; } - this.queuing = (options.queuing !== undefined) ? options.queuing : true; this.queue = new RequestQueue({ size: parseInt((options.queueSize || 0), 10), timeout: parseInt((options.queueTimeout || 0), 10) }); - if (!this.queuing) { + if (options.queueDisable) { this.queue.freeze(); } @@ -1065,7 +1064,7 @@ Client.prototype._send = function _send(message, } if (!this.socket || !this.connected) { if (!this.queue.enqueue(message, expect, emitter, callback)) { - callback(new Error('unable to enqueue request')); + callback(new ConnectionError('connection unavailable')); } // Initiate reconnect if needed if (this.reconnect) {