diff --git a/lbry/blockchain/sync/claims.py b/lbry/blockchain/sync/claims.py index dd4db8ce0..5e77cd82f 100644 --- a/lbry/blockchain/sync/claims.py +++ b/lbry/blockchain/sync/claims.py @@ -58,9 +58,9 @@ def staked_support_count_calc(other): def make_label(action, blocks): if blocks[0] == blocks[-1]: - return f"{action}{blocks[0]:>6}" + return f"{action} {blocks[0]:>6}" else: - return f"{action}{blocks[0]:>6}-{blocks[-1]:>6}" + return f"{action} {blocks[0]:>6}-{blocks[-1]:>6}" def select_claims_for_saving( @@ -175,7 +175,7 @@ def claims_update(blocks: Tuple[int, int], p: ProgressContext): for row in cursor: txo, extra = row_to_claim_for_saving(row) loader.update_claim(txo, **extra) - if len(loader.update_claims) >= 500: + if len(loader.update_claims) >= 25: p.add(loader.flush(Claim)) p.add(loader.flush(Claim)) diff --git a/lbry/console.py b/lbry/console.py index ed122ddc8..8fba0fe49 100644 --- a/lbry/console.py +++ b/lbry/console.py @@ -394,7 +394,7 @@ class Advanced(Basic): label = d.get('label', name[-11:]) self.get_or_create_bar( f"{name}#{d['id']}", label, d['units'], d['total'], - name.split('.')[-1] not in ('insert', 'update') + name.split('.')[-1] not in ('insert', 'update', 'file') ) else: if d['done'][0] != -1: diff --git a/lbry/db/tables.py b/lbry/db/tables.py index b8fe1e0ed..2421a3fa7 100644 --- a/lbry/db/tables.py +++ b/lbry/db/tables.py @@ -203,17 +203,6 @@ Claim = Table( ) -def pg_add_claim_constraints_and_indexes(execute): - execute(text("ALTER TABLE claim ADD PRIMARY KEY (claim_hash);")) - # finding claims that aren't updated with latest TXO - execute(text("CREATE INDEX claim_txo_hash ON claim (txo_hash);")) - # used to calculate content in a channel - execute(text(""" - CREATE INDEX signed_content ON claim (channel_hash) - INCLUDE (amount) WHERE is_signature_valid; - """)) - - Tag = Table( 'tag', metadata, Column('claim_hash', LargeBinary), @@ -221,6 +210,20 @@ Tag = Table( ) +def pg_add_claim_constraints_and_indexes(execute): + execute(text("ALTER TABLE claim ADD PRIMARY KEY (claim_hash);")) + execute(text("ALTER TABLE tag ADD PRIMARY KEY (claim_hash, tag);")) + # take over updates are base on normalized name + execute(text("CREATE INDEX claim_normalized ON claim (normalized);")) + # finding claims that aren't updated with latest TXO + execute(text("CREATE UNIQUE INDEX claim_txo_hash ON claim (txo_hash);")) + # used to calculate content in a channel + execute(text(""" + CREATE INDEX signed_content ON claim (channel_hash) + INCLUDE (amount) WHERE is_signature_valid; + """)) + + Support = Table( 'support', metadata,