Skip to content

Commit

Permalink
Merge pull request #131 from telefonicaid/bug/timeoutsInCommands
Browse files Browse the repository at this point in the history
ADD Timeout for command calls
  • Loading branch information
XavierVal authored Jul 7, 2016
2 parents 04a9e9a + 0f7fe11 commit 7343742
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- FIX Commands won't write the Error results in the Context Broker.
- No timeout defined for HTTP commands (#97)
5 changes: 5 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ config.http = {
* Port where the HTTP Ultralight transport binding will be listening for device requests.
*/
port: 7896

/**
* HTTP Timeout for the http command endpoint (in miliseconds).
*/
//timeout: 1000
};

config.iota = {
Expand Down
5 changes: 5 additions & 0 deletions lib/bindings/HTTPBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ function generateCommandExecution(apiKey, device, attribute) {
}
};


if (config.getConfig().http.timeout) {
options.timeout = config.getConfig().http.timeout;
}

return function sendUlCommandHTTP(callback) {
request(options, function(error, response, body) {
if (error) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "iotagent-ul",
"description": "IoT Agent for the Ultrlight 2.0 protocol",
"version": "1.1.6",
"version": "1.1.7",
"homepage": "https://github.com/dmoranj/iotagent-ul",
"author": {
"name": "Daniel Moran",
Expand Down

0 comments on commit 7343742

Please sign in to comment.