I am running geth -rpc
and node
to directly interact with the blockchain. When executing a large amount of requests I noticed the following error:
http: Accept error: accept tcp 127.0.0.1:8545: accept: too many open files; retrying in 5ms
How can I configure geth to handle more connections? My code is:
var Web3 = require("web3")
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
// first
txs = [];
// second
for (i = 0; i < 100; i++) {
web3.eth.getBlock(4000000+i, function(error, block) {
if(!error) {
for (j = 0; j < block.transactions.length; j++) {
web3.eth.getTransaction(block.transactions[j], function(error, transaction) {
if(!error) {
txs.push({block: transaction.blockNumber, from: transaction.from, to: transaction.to, value: transaction.value.toNumber(), id: block.transactions.indexOf(transaction.hash)})
}
else
console.error(error);
});
}
}
else
console.error(error);
});
}