Navigation Menu

Skip to content

Commit

Permalink
Brush up detection of default timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 20, 2015
1 parent 0e76e9a commit d3ea485
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/droonga-protocol/connection.js
Expand Up @@ -63,7 +63,7 @@ Connection.prototype._init = function() {
this._params.defaultDataset ||
'';
this.defaultTimeout = this._params.defaultTimeout ||
null;
DEFAULT_RESPONSE_TIMEOUT_SECONDS;
this.hostName = this._params.hostName ||
process.env.DROONGA_ENGINE_HOST ||
DEFAULT_FLUENT_HOST_NAME;
Expand Down Expand Up @@ -269,14 +269,8 @@ Connection.prototype.emitMessage = function(type, body, callback, options) {
}
}).bind(this));

if (typeof options.timeout == 'number') {
options.timeout = toFloat(options.timeout)
}
else {
options.timeout = DEFAULT_RESPONSE_TIMEOUT_SECONDS;
}
if (options.timeout > -1) {
var timeoutMilliseconds = options.timeout * ONE_SECOND_IN_MILLISECONDS;
var timeoutMilliseconds = envelope.timeout * ONE_SECOND_IN_MILLISECONDS;
timeoutId = setTimeout((function() {
this._logger.trace('Connection timed out (message id: '+id+')');
this.removeAllListeners(event);
Expand Down

0 comments on commit d3ea485

Please sign in to comment.