Skip to content

Commit

Permalink
Use meaningful constant name for default value
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 20, 2015
1 parent de81429 commit 212e469
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/adapter/api/droonga.js
@@ -1,5 +1,7 @@
var command = require('../command');

var DEFAULT_TIMEOUT = 1000;

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

0 comments on commit 212e469

Please sign in to comment.