File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ async def indexer(from_block: int, to_block: int):
5252 # Log time before fetching a new block
5353 fetch_start_time = time .time ()
5454 # streamer_message is the current block
55- streamer_message = await streamer_messages_queue .get ()
55+ streamer_message = await asyncio . wait_for ( streamer_messages_queue .get (), 30 )
5656 fetch_end_time = time .time ()
5757 logger .info (
5858 f"Time to fetch new block: { fetch_end_time - fetch_start_time :.4f} seconds"
@@ -85,6 +85,11 @@ async def indexer(from_block: int, to_block: int):
8585 logger .info (
8686 f"Total time for one iteration: { iteration_end_time - fetch_start_time :.4f} seconds"
8787 )
88+
89+
90+ except asyncio .TimeoutError :
91+ logger .warning ("Stream stalled: no new blocks within timeout, restarting..." ) # raise Exception so sytemd can restart the worker
92+ raise Exception ("Stream stalled: restarting..." )
8893
8994 except Exception as e :
9095 logger .error (f"Error in streamer_messages_queue: { e } " )
You can’t perform that action at this time.
0 commit comments