Skip to content

Commit

Permalink
fix: surface errors in persistence when saving results
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshultz committed Nov 24, 2023
1 parent e96e4f2 commit 29fa6ce
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions silverback/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ async def _handle_result(
self.ident, handler_id, block_number, log_index, result
)

await self.persistence.add_result(handler_result)
try:
await self.persistence.add_result(handler_result)
except Exception as err:
logger.error(f"Error storing result: {err}")

async def _checkpoint(
self, last_block_seen: int = 0, last_block_processed: int = 0
Expand All @@ -74,9 +77,12 @@ async def _checkpoint(
self.last_block_processed = max(last_block_processed, self.last_block_processed)

if self.persistence:
await self.persistence.set_instance_state(
self.ident, self.last_block_seen, self.last_block_processed
)
try:
await self.persistence.set_instance_state(
self.ident, self.last_block_seen, self.last_block_processed
)
except Exception as err:
logger.error(f"Error settings state: {err}")

return self.last_block_seen, self.last_block_processed

Expand Down

0 comments on commit 29fa6ce

Please sign in to comment.