Navigation Menu

Skip to content

Commit

Permalink
Indicate unit of timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 20, 2015
1 parent b91bc92 commit bfc2550
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/adapter/api/droonga.js
@@ -1,6 +1,6 @@
var command = require('../command');

var DEFAULT_TIMEOUT = 1000;
var DEFAULT_TIMEOUT_SECONDS = 1000;

function pathToMessageType(path) {
return path
Expand All @@ -16,7 +16,7 @@ module.exports = {
onRequest: function(request, connection) {
var messageType = pathToMessageType(request.params[0]);
var body = {};
body.timeout = body.timeout || request.query.timeout || DEFAULT_TIMEOUT;
body.timeout = body.timeout || request.query.timeout || DEFAULT_TIMEOUT_SECONDS;
connection.emit(messageType, body);
}
}),
Expand All @@ -32,7 +32,7 @@ module.exports = {
});
request.on('end', function() {
body = JSON.parse(body);
body.timeout = body.timeout || request.query.timeout || DEFAULT_TIMEOUT;
body.timeout = body.timeout || request.query.timeout || DEFAULT_TIMEOUT_SECONDS;
body.type = body.type || 'droonga-' + messageType;
connection.emit(messageType, body);
});
Expand Down

0 comments on commit bfc2550

Please sign in to comment.