fixed checkpointing

pull/617/head
Yhtyyar Sahatov 2022-04-04 18:00:55 +03:00
rodzic 86efbad8c2
commit c11fbe0e30
2 zmienionych plików z 6 dodań i 5 usunięć

Wyświetl plik

@ -69,12 +69,12 @@ def handle_materialize(args: argparse.Namespace) -> None:
EthereumLabel if args.blockchain == Blockchain.ETHEREUM else PolygonLabel
)
print(label_model)
with yield_db_session_ctx() as db_session, contextlib.closing(
sqlite3.connect(args.datastore)
) as moonstream_datastore:
last_saved_block = get_last_saved_block(moonstream_datastore, args.blockchain)
last_saved_block = get_last_saved_block(
moonstream_datastore, args.blockchain.value
)
logger.info(f"Last saved block: {last_saved_block}")
if last_saved_block >= bounds.starting_block:
logger.info(

Wyświetl plik

@ -389,10 +389,11 @@ def get_last_saved_block(conn: sqlite3.Connection, blockchain_type: str) -> int:
query = f"SELECT MAX(blockNumber) FROM transactions WHERE blockchainType = '{blockchain_type}'"
cur.execute(query)
if cur.fetchone()[0] is None:
result = cur.fetchone()
if result is None:
return 0
return cur.fetchone()[0]
return result[0]
def setup_database(conn: sqlite3.Connection) -> None: