Skip to content

Commit

Permalink
change retry handling
Browse files Browse the repository at this point in the history
  • Loading branch information
soad003 committed Jul 10, 2024
1 parent 3957729 commit a7b0a2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SHELL := /bin/bash
PROJECT := graphsense-lib
VENV := venv
RELEASE := 'v24.07.6'
RELEASESEM := 'v2.3.6'
RELEASE := 'v24.07.6.dev2'
RELEASESEM := 'v2.3.6.dev2'


all: format lint test build
Expand Down
13 changes: 5 additions & 8 deletions src/graphsenselib/ingest/tron/export_traces_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,13 @@ def run(self):

return traces, fees

async def fetch_and_process_block(self, i, wallet_stub, retries=5, timeout=60):
async def fetch_and_process_block(self, i, wallet_stub, retries=5, timeout=3 * 60):
# attempt = 0

# while attempt < retries:
# try:
block = await asyncio.wait_for(
wallet_stub.GetTransactionInfoByBlockNum(
NumberMessage(num=i), timeout=timeout
),
timeout=timeout,
block = wallet_stub.GetTransactionInfoByBlockNum(
NumberMessage(num=i), timeout=timeout
)
traces_per_block = decode_block_to_traces(i, block)
fees_per_block = decode_fees(i, block)
Expand Down Expand Up @@ -221,9 +218,9 @@ async def sem_fetch_and_process_block(i):
while attempt < retries:
try:
return loop.run_until_complete(
asyncio.wait_for(run_async(), timeout=15 * 60)
asyncio.wait_for(run_async(), timeout=timeout)
)
except (grpc.RpcError, asyncio.TimeoutError) as e:
except asyncio.TimeoutError as e:
logger.error(
f"Error fetching block range in {timeout}s "
f"{self.start_block} {self.end_block}, attempt {attempt + 1}: {e}"
Expand Down

0 comments on commit a7b0a2d

Please sign in to comment.