kopia lustrzana https://github.com/bugout-dev/moonstream
Add changes.
rodzic
4c7a7fdaf6
commit
a3038b1f88
|
@ -11,6 +11,7 @@ from moonstreamdb.db import (
|
|||
MOONSTREAM_DB_URI,
|
||||
MOONSTREAM_POOL_SIZE,
|
||||
create_moonstream_engine,
|
||||
yield_db_read_only_session_ctx,
|
||||
)
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from .db import (
|
||||
|
@ -91,11 +92,13 @@ def parse_metadata(
|
|||
db_session = process_session()
|
||||
|
||||
# run crawling of levels
|
||||
|
||||
with yield_db_read_only_session_ctx() as db_session_read_only:
|
||||
try:
|
||||
|
||||
# get all tokens with uri
|
||||
logger.info("Requesting all tokens with uri from database")
|
||||
uris_of_tokens = get_uris_of_tokens(db_session, blockchain_type)
|
||||
uris_of_tokens = get_uris_of_tokens(db_session_read_only, blockchain_type)
|
||||
|
||||
tokens_uri_by_address: Dict[str, Any] = {}
|
||||
|
||||
|
@ -109,11 +112,15 @@ def parse_metadata(
|
|||
logger.info(f"Starting to crawl metadata for address: {address}")
|
||||
|
||||
already_parsed = get_current_metadata_for_address(
|
||||
db_session=db_session, blockchain_type=blockchain_type, address=address
|
||||
db_session=db_session_read_only,
|
||||
blockchain_type=blockchain_type,
|
||||
address=address,
|
||||
)
|
||||
|
||||
maybe_updated = get_tokens_wich_maybe_updated(
|
||||
db_session=db_session, blockchain_type=blockchain_type, address=address
|
||||
db_session=db_session_read_only,
|
||||
blockchain_type=blockchain_type,
|
||||
address=address,
|
||||
)
|
||||
leak_rate = 0.0
|
||||
|
||||
|
|
|
@ -244,9 +244,9 @@ def clean_labels_from_db(
|
|||
WHERE
|
||||
label=:label
|
||||
AND address=:address
|
||||
AND polygon_labels.id not in (select id from lates_token_metadata) RETURNING polygon_labels.block_number;
|
||||
AND {}.id not in (select id from lates_token_metadata) RETURNING {}.block_number;
|
||||
""".format(
|
||||
table, table
|
||||
table, table, table, table
|
||||
),
|
||||
{"address": address, "label": METADATA_CRAWLER_LABEL},
|
||||
)
|
||||
|
|
Ładowanie…
Reference in New Issue