Reduce excess block polling when using Web3ProviderEngine
This commit is contained in:
parent
4e745489db
commit
8272c7a74e
@ -31,8 +31,10 @@ export const providerFactory = {
|
|||||||
// TODO(bmillman): make this more resilient to infura failures
|
// TODO(bmillman): make this more resilient to infura failures
|
||||||
const rpcUrl = ETHEREUM_NODE_URL_BY_NETWORK[network];
|
const rpcUrl = ETHEREUM_NODE_URL_BY_NETWORK[network];
|
||||||
providerEngine.addProvider(new RPCSubprovider(rpcUrl));
|
providerEngine.addProvider(new RPCSubprovider(rpcUrl));
|
||||||
// // Start the Provider Engine
|
// Start the Provider Engine
|
||||||
providerEngine.start();
|
// HACK: Start the provider without unused block polling
|
||||||
|
// providerEngine.start();
|
||||||
|
(providerEngine as any)._ready.go();
|
||||||
return providerEngine;
|
return providerEngine;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -125,7 +125,9 @@ export class Blockchain {
|
|||||||
return new RPCSubprovider(publicNodeUrl);
|
return new RPCSubprovider(publicNodeUrl);
|
||||||
});
|
});
|
||||||
provider.addProvider(new RedundantSubprovider(rpcSubproviders));
|
provider.addProvider(new RedundantSubprovider(rpcSubproviders));
|
||||||
provider.start();
|
// HACK: Start the provider without unused block polling
|
||||||
|
// provider.start();
|
||||||
|
(provider as any)._ready.go();
|
||||||
return [provider, ledgerSubprovider];
|
return [provider, ledgerSubprovider];
|
||||||
} else if (doesInjectedProviderExist && isPublicNodeAvailableForNetworkId) {
|
} else if (doesInjectedProviderExist && isPublicNodeAvailableForNetworkId) {
|
||||||
// We catch all requests involving a users account and send it to the injectedWeb3
|
// We catch all requests involving a users account and send it to the injectedWeb3
|
||||||
@ -143,7 +145,9 @@ export class Blockchain {
|
|||||||
return new RPCSubprovider(publicNodeUrl);
|
return new RPCSubprovider(publicNodeUrl);
|
||||||
});
|
});
|
||||||
provider.addProvider(new RedundantSubprovider(rpcSubproviders));
|
provider.addProvider(new RedundantSubprovider(rpcSubproviders));
|
||||||
provider.start();
|
// HACK: Start the provider without unused block polling
|
||||||
|
// provider.start();
|
||||||
|
(provider as any)._ready.go();
|
||||||
return [provider, undefined];
|
return [provider, undefined];
|
||||||
} else if (doesInjectedProviderExist) {
|
} else if (doesInjectedProviderExist) {
|
||||||
// Since no public node for this network, all requests go to injectedWeb3 instance
|
// Since no public node for this network, all requests go to injectedWeb3 instance
|
||||||
@ -159,7 +163,9 @@ export class Blockchain {
|
|||||||
return new RPCSubprovider(publicNodeUrl);
|
return new RPCSubprovider(publicNodeUrl);
|
||||||
});
|
});
|
||||||
provider.addProvider(new RedundantSubprovider(rpcSubproviders));
|
provider.addProvider(new RedundantSubprovider(rpcSubproviders));
|
||||||
provider.start();
|
// HACK: Start the provider without unused block polling
|
||||||
|
// provider.start();
|
||||||
|
(provider as any)._ready.go();
|
||||||
return [provider, undefined];
|
return [provider, undefined];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user