From 774f734b435a1b600c9a96593ca0116f27e83aef Mon Sep 17 00:00:00 2001 From: belikor Date: Tue, 3 Aug 2021 12:55:07 -0500 Subject: [PATCH 1/2] Daemon.jsonrpc_claim_search: `page_size` is set to maximum instead of minimum Currently with `lbrynet claim search` when `--page_size` is specified, it will use the minimum of this value or 50. So, if it's `--page_size=1000` it will still use 50. If `--page_size` is omitted, it will use the minimum of `DEFAULT_PAGE_SIZE` (normally 20) or 50. So, instead of using `min` we use `max`, meaning that a larger `page_size` value will be used. This will allow us to fit as many elements as possible in the claim search. However, there is still a separate bug, lbry-sdk issue #3365, which limits the total results to 1000, no matter the `page_size`. --- lbry/extras/daemon/daemon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index b6a9260798..a66423e27b 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -2507,7 +2507,7 @@ async def jsonrpc_claim_search(self, **kwargs): kwargs['signature_valid'] = 0 if 'has_no_source' in kwargs: kwargs['has_source'] = not kwargs.pop('has_no_source') - page_num, page_size = abs(kwargs.pop('page', 1)), min(abs(kwargs.pop('page_size', DEFAULT_PAGE_SIZE)), 50) + page_num, page_size = abs(kwargs.pop('page', 1)), max(abs(kwargs.pop('page_size', DEFAULT_PAGE_SIZE)), 50) kwargs.update({'offset': page_size * (page_num - 1), 'limit': page_size}) txos, blocked, _, total = await self.ledger.claim_search(wallet.accounts, **kwargs) result = { From 5bb02c17293a0c33cf2d6b565a0adfaab0254546 Mon Sep 17 00:00:00 2001 From: belikor Date: Sun, 22 Aug 2021 21:42:40 -0500 Subject: [PATCH 2/2] Daemon.jsonrpc_claim_search: `page_size` is set to `DEFAULT_PAGE_SIZE` if none entered Currently with `lbrynet claim search` when `--page_size` is specified, it will use the minimum of this value or 50. So, if it's `--page_size=1000` it will still use 50. If `--page_size` is omitted, it will use the minimum of `DEFAULT_PAGE_SIZE` (normally 20) or 50, so it will use 20. So, instead of using `min` we simply remove this function. In this case, it will use simply use the value of `page_size`, or if this is missing, it will use `DEFAULT_PAGE_SIZE`, which should always be available. By using a large `page_size`, this will allow us to fit as many elements as possible in the claim search. However, there is still a separate bug, lbry-sdk issue #3365, which limits the total results to 1000, no matter the `page_size`. --- lbry/extras/daemon/daemon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index a66423e27b..7941886708 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -2507,7 +2507,7 @@ async def jsonrpc_claim_search(self, **kwargs): kwargs['signature_valid'] = 0 if 'has_no_source' in kwargs: kwargs['has_source'] = not kwargs.pop('has_no_source') - page_num, page_size = abs(kwargs.pop('page', 1)), max(abs(kwargs.pop('page_size', DEFAULT_PAGE_SIZE)), 50) + page_num, page_size = abs(kwargs.pop('page', 1)), abs(kwargs.pop('page_size', DEFAULT_PAGE_SIZE)) kwargs.update({'offset': page_size * (page_num - 1), 'limit': page_size}) txos, blocked, _, total = await self.ledger.claim_search(wallet.accounts, **kwargs) result = {