Implement switching endpoints after slow eth_getLogs RPC requests (#525)

* Switch upstream endpoint if getLogs requests are too slow

* Refactor methods for switching client to indexer

* Update codegen indexer template

* Add dummy methods in graph-node test Indexer

* Upgrade package versions to 0.2.101

---------

Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
2024-06-20 17:57:01 +05:30
committed by GitHub
co-authored by prathamesh
parent ff471da287
commit b9a899aec1
24 changed files with 162 additions and 108 deletions
+5 -5
View File
@@ -1,10 +1,10 @@
{
"name": "@cerc-io/graph-node",
"version": "0.2.100",
"version": "0.2.101",
"main": "dist/index.js",
"license": "AGPL-3.0",
"devDependencies": {
"@cerc-io/solidity-mapper": "^0.2.100",
"@cerc-io/solidity-mapper": "^0.2.101",
"@ethersproject/providers": "^5.4.4",
"@graphprotocol/graph-ts": "^0.22.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
@@ -51,9 +51,9 @@
"dependencies": {
"@apollo/client": "^3.3.19",
"@cerc-io/assemblyscript": "0.19.10-watcher-ts-0.1.2",
"@cerc-io/cache": "^0.2.100",
"@cerc-io/ipld-eth-client": "^0.2.100",
"@cerc-io/util": "^0.2.100",
"@cerc-io/cache": "^0.2.101",
"@cerc-io/ipld-eth-client": "^0.2.101",
"@cerc-io/util": "^0.2.101",
"@types/json-diff": "^0.5.2",
"@types/yargs": "^17.0.0",
"bn.js": "^4.11.9",
+5 -1
View File
@@ -340,7 +340,11 @@ export class Indexer implements IndexerInterface {
return [];
}
switchClients ({ ethClient, ethProvider }: { ethClient: EthClient, ethProvider: providers.BaseProvider }): void {
async switchClients (): Promise<void> {
return undefined;
}
async isGetLogsRequestsSlow (): Promise<boolean> {
return false;
}
}