From e4d06a088b2227d24cd0e2797f61020095d1c739 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Sun, 31 Jan 2021 04:42:22 -0300 Subject: [PATCH] include the channel being filtered/blocked --- lbry/wallet/server/block_processor.py | 4 ++-- lbry/wallet/server/db/elastic_search.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index 0a2e567b0..4dc16a27a 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -217,8 +217,6 @@ class BlockProcessor: start = time.perf_counter() await self.run_in_thread_with_lock(self.advance_blocks, blocks) await self.db.search_index.sync_queue(self.sql.claim_queue) - await self.db.search_index.apply_filters(self.sql.blocked_streams, self.sql.blocked_channels, - self.sql.filtered_streams, self.sql.filtered_channels) for cache in self.search_cache.values(): cache.clear() self.history_cache.clear() @@ -232,6 +230,8 @@ class BlockProcessor: s = '' if len(blocks) == 1 else 's' self.logger.info('processed {:,d} block{} in {:.1f}s'.format(len(blocks), s, processed_time)) if self._caught_up_event.is_set(): + await self.db.search_index.apply_filters(self.sql.blocked_streams, self.sql.blocked_channels, + self.sql.filtered_streams, self.sql.filtered_channels) await self.notifications.on_block(self.touched, self.height) self.touched = set() elif hprevs[0] != chain[0]: diff --git a/lbry/wallet/server/db/elastic_search.py b/lbry/wallet/server/db/elastic_search.py index 7f5cd508d..1f3b916b5 100644 --- a/lbry/wallet/server/db/elastic_search.py +++ b/lbry/wallet/server/db/elastic_search.py @@ -99,12 +99,16 @@ class SearchIndex: await self.client.update_by_query(self.index, body=make_query(1, filtered_streams), slices=32) await self.client.indices.refresh(self.index) if filtered_channels: + await self.client.update_by_query(self.index, body=make_query(1, filtered_channels), slices=32) + await self.client.indices.refresh(self.index) await self.client.update_by_query(self.index, body=make_query(1, filtered_channels, True), slices=32) await self.client.indices.refresh(self.index) if blocked_streams: await self.client.update_by_query(self.index, body=make_query(2, blocked_streams), slices=32) await self.client.indices.refresh(self.index) if blocked_channels: + await self.client.update_by_query(self.index, body=make_query(2, blocked_channels), slices=32) + await self.client.indices.refresh(self.index) await self.client.update_by_query(self.index, body=make_query(2, blocked_channels, True), slices=32) await self.client.indices.refresh(self.index)