From f89c7540b7ad5746e9a0d58a7355ccc2c8899725 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 11 Jan 2021 10:36:21 -0500 Subject: [PATCH] bulk insert --- lbry/db/queries/filters.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lbry/db/queries/filters.py b/lbry/db/queries/filters.py index 65bcef13f..662df4dac 100644 --- a/lbry/db/queries/filters.py +++ b/lbry/db/queries/filters.py @@ -155,13 +155,15 @@ def get_tx_matchers_for_missing_txs() -> List[Tuple[int, PyBIP158]]: ] -def insert_block_filter(height: int, factor: int, address_filter: bytes): +def insert_block_filters(filters): loader = context().get_bulk_loader() - loader.add_block_filter(height, factor, address_filter) + for height, factor, address_filter in filters: + loader.add_block_filter(height, factor, address_filter) loader.flush(return_row_count_for_table=None) -def insert_tx_filter(tx_hash: bytes, height: int, address_filter: bytes): +def insert_tx_filters(filters): loader = context().get_bulk_loader() - loader.add_transaction_filter(tx_hash, height, address_filter) + for tx_hash, height, address_filter in filters: + loader.add_transaction_filter(tx_hash, height, address_filter) loader.flush(return_row_count_for_table=None)