kopia lustrzana https://github.com/bugout-dev/moonstream
checking for None for checkpoint
rodzic
721fd61e02
commit
8594ba9bf5
|
@ -76,7 +76,7 @@ def handle_materialize(args: argparse.Namespace) -> None:
|
|||
moonstream_datastore, args.blockchain.value
|
||||
)
|
||||
logger.info(f"Last saved block: {last_saved_block}")
|
||||
if last_saved_block >= bounds.starting_block:
|
||||
if last_saved_block and last_saved_block >= bounds.starting_block:
|
||||
logger.info(
|
||||
f"Skipping blocks {bounds.starting_block}-{last_saved_block}, starting from {last_saved_block + 1}"
|
||||
)
|
||||
|
|
|
@ -380,7 +380,9 @@ def insert_events(
|
|||
conn.commit()
|
||||
|
||||
|
||||
def get_last_saved_block(conn: sqlite3.Connection, blockchain_type: str) -> int:
|
||||
def get_last_saved_block(
|
||||
conn: sqlite3.Connection, blockchain_type: str
|
||||
) -> Optional[int]:
|
||||
"""
|
||||
Returns the last block number that was saved to the database.
|
||||
"""
|
||||
|
@ -390,8 +392,6 @@ def get_last_saved_block(conn: sqlite3.Connection, blockchain_type: str) -> int:
|
|||
|
||||
cur.execute(query)
|
||||
result = cur.fetchone()
|
||||
if result is None:
|
||||
return 0
|
||||
|
||||
return result[0]
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue