Skip to content

Commit

Permalink
Merge pull request #963 from andrevmatos/webui
Browse files Browse the repository at this point in the history
Add small timeout on web3 test request
  • Loading branch information
ulope committed Sep 1, 2017
2 parents 012f5c4 + 49156f6 commit 724ae44
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion raiden/ui/web/src/app/services/raiden.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ export class RaidenConfig {
.subscribe((config) => {
this.config = Object.assign({}, default_config, config);
this.api = this.config.raiden;
this.web3 = new Web3(new Web3.providers.HttpProvider(this.config.web3));
this.web3 = new Web3(new Web3.providers.HttpProvider(this.config.web3, 2000));
// make a simple test call to web3
this.web3.version.getNetwork((err, res) => {
if (err) {
console.error('Invalid web3 endpoint', err);
console.info('Switching to fallback: ' + this.config.web3_fallback);
this.config.web3 = this.config.web3_fallback;
this.web3 = new Web3(new Web3.providers.HttpProvider(this.config.web3));
} else {
// on success, reconstruct without timeout,
// because of long (events) running requests
this.web3 = new Web3(new Web3.providers.HttpProvider(this.config.web3));
}
resolve();
});
Expand Down

0 comments on commit 724ae44

Please sign in to comment.