Skip to content

Commit 6ede3cc

Browse files
committed
added small sleeps to max batch size and max filter range checks on Web3Advanced init to prevent them from hitting rate limits.
1 parent 6eee9dd commit 6ede3cc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

IceCreamSwapWeb3/Web3Advanced.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from importlib.resources import files
3+
from time import sleep
34

45
from eth_utils import to_checksum_address
56
from web3 import Web3
@@ -106,7 +107,7 @@ def _find_max_filter_range(self) -> int:
106107
assert result == []
107108
return filter_range
108109
except Exception:
109-
pass
110+
sleep(0.1)
110111
print(f"Can not use eth_getLogs with RPC {self.node_url}")
111112
return 0
112113

@@ -120,7 +121,7 @@ def _find_max_batch_size(self) -> int:
120121
assert len(result) == batch_size
121122
return batch_size
122123
except Exception:
123-
pass
124+
sleep(0.1)
124125
print(f"Can not use batch requests with RPC {self.node_url}")
125126
return 0
126127

0 commit comments

Comments
 (0)