kopia lustrzana https://github.com/bugout-dev/moonstream
				
				
				
			fixed checkpointing
							rodzic
							
								
									86efbad8c2
								
							
						
					
					
						commit
						c11fbe0e30
					
				| 
						 | 
				
			
			@ -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(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue