runner worker error reports
This commit is contained in:
@@ -174,30 +174,35 @@ class BlockStateRunner:
|
|||||||
|
|
||||||
|
|
||||||
async def worker(self):
|
async def worker(self):
|
||||||
log.debug(f'runner worker started')
|
try:
|
||||||
w3 = current_w3.get()
|
log.debug(f'runner worker started')
|
||||||
chain = current_chain.get()
|
w3 = current_w3.get()
|
||||||
assert chain.chain_id == await w3.eth.chain_id
|
chain = current_chain.get()
|
||||||
current_clock.set(BlockClock())
|
assert chain.chain_id == await w3.eth.chain_id
|
||||||
prev_head = None
|
current_clock.set(BlockClock())
|
||||||
while self.running:
|
prev_head = None
|
||||||
try:
|
while self.running:
|
||||||
async with asyncio.timeout(1): # check running flag every second
|
|
||||||
head = await self.queue.get()
|
|
||||||
except TimeoutError:
|
|
||||||
log.debug('timeout in runner')
|
|
||||||
# 1 second has passed without a new head. Run the postprocess callbacks to check for activated time-based triggers
|
|
||||||
if prev_head is not None:
|
|
||||||
await self.handle_time_tick(head)
|
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
log.debug('handle head...')
|
async with asyncio.timeout(1): # check running flag every second
|
||||||
await self.handle_head(chain, head, w3)
|
head = await self.queue.get()
|
||||||
log.debug('handled')
|
except TimeoutError:
|
||||||
prev_head = head
|
log.debug('timeout in runner')
|
||||||
except Exception as x:
|
# 1 second has passed without a new head. Run the postprocess callbacks to check for activated time-based triggers
|
||||||
log.exception(x)
|
if prev_head is not None:
|
||||||
log.debug('runner worker exiting')
|
await self.handle_time_tick(head)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
log.debug('handle head...')
|
||||||
|
await self.handle_head(chain, head, w3)
|
||||||
|
log.debug('handled')
|
||||||
|
prev_head = head
|
||||||
|
except Exception as x:
|
||||||
|
log.exception(x)
|
||||||
|
except:
|
||||||
|
log.exception('exception in runner worker')
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
log.debug('runner worker exiting')
|
||||||
|
|
||||||
|
|
||||||
async def handle_head(self, chain, blockhash, w3):
|
async def handle_head(self, chain, blockhash, w3):
|
||||||
|
|||||||
Reference in New Issue
Block a user