Skip to content

Commit

Permalink
feat: additional logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nick8319 committed Jun 12, 2023
1 parent 12a0232 commit 56f4d0f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gnosis/eth/ethereum_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,12 +1240,16 @@ def raw_batch_request(

batch_size = batch_size or self.batch_request_max_size

logger.info("Batch request payload: %s", payload)

all_results = []
# Temporary disable batch requests
for chunk in payload:
logger.info("Batch request chunk: %s", chunk)
response = self.http_session.post(
self.ethereum_node_url, json=chunk, timeout=self.slow_timeout
)
logger.info("Batch request response: %s", response)

if not response.ok:
logger.error(
Expand All @@ -1257,6 +1261,7 @@ def raw_batch_request(
raise ValueError(f"Batch request error: {response.content}")

results = response.json()
logger.info("Batch request results: %s", results)

# If there's an error some nodes return a json instead of a list
if isinstance(results, dict) and "error" in results:
Expand All @@ -1267,7 +1272,7 @@ def raw_batch_request(

all_results.extend(results)

logger.info("Batch request results: %s", all_results)
logger.info("Batch request all_results: %s", all_results)

# Nodes like Erigon send back results out of order
for query, result in zip(payload, sorted(all_results, key=lambda x: x["id"])):
Expand Down

0 comments on commit 56f4d0f

Please sign in to comment.