Skip to content

Commit

Permalink
Connection timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekn committed Oct 19, 2015
1 parent 0803c5a commit e08f0c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
"dependencies": {
"URIjs": "^1.16.0",
"axios": "^0.5.4",
"axios": "^0.6.0",
"bluebird": "^2.9.25",
"event-source-polyfill": "0.0.6",
"eventsource": "^0.1.6",
Expand Down
8 changes: 7 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ let toBluebird = require("bluebird").resolve;
let URI = require("URIjs");
let URITemplate = require("URIjs").URITemplate;

export const SUBMIT_TRANSACTION_TIMEOUT = 20*1000;

/**
* @class Server
*/
Expand Down Expand Up @@ -46,7 +48,11 @@ export class Server {
*/
submitTransaction(transaction) {
let tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
var promise = axios.post(URI(this.serverURL).path('transactions').toString(), `tx=${tx}`)
var promise = axios.post(
URI(this.serverURL).path('transactions').toString(),
`tx=${tx}`,
{timeout: SUBMIT_TRANSACTION_TIMEOUT}
)
.then(function(response) {
return response.data;
})
Expand Down

0 comments on commit e08f0c1

Please sign in to comment.