Alter client queue parameters and error reporting

- Use 'queueDisable' as option for disabling client RequestQueue
- Throw more meaningful ConnectionError when enqueue fails
This commit is contained in:
Patrick Mooney 2014-06-25 14:38:26 -05:00
parent b49c2efed2
commit 9e2bbe1072
1 changed files with 2 additions and 3 deletions

View File

@ -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) {