Skip to content

Commit

Permalink
ensure some small delay is introduced after each api call
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed Sep 7, 2024
1 parent 1e93fc2 commit 98e94dc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/fees/compute_fees.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,18 +406,17 @@ def get_all_data(self, tx_hash: HexBytes) -> SettlementData:

def get_auction_data(self, tx_hash: HexBytes):
for i in range(API_NUM_OF_RETRIES):
sleep(0.5)
for environment, url in self.orderbook_urls.items():
try:
response = requests.get(
url + f"solver_competition/by_tx_hash/{tx_hash.to_0x_hex()}",
timeout=REQUEST_TIMEOUT,
)
response.raise_for_status()
auction_data = response.json()
sleep(
0.5
) # introducing some delays so that we don't overload the api
response.raise_for_status()
auction_data = response.json()
return auction_data, environment
except requests.exceptions.HTTPError as err:
if err.response.status_code == 404:
Expand Down

0 comments on commit 98e94dc

Please sign in to comment.