From 92df0983f1980f603b11a2974ac57436295fd379 Mon Sep 17 00:00:00 2001 From: cyc60 Date: Thu, 24 Aug 2023 14:03:34 +0300 Subject: [PATCH] Move chunk size to settings Signed-off-by: cyc60 --- oracle/oracle/rewards/controller.py | 3 ++- oracle/settings.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/oracle/oracle/rewards/controller.py b/oracle/oracle/rewards/controller.py index 96631e9..3400eeb 100644 --- a/oracle/oracle/rewards/controller.py +++ b/oracle/oracle/rewards/controller.py @@ -25,6 +25,7 @@ MGNO_RATE, NETWORK, NETWORK_CONFIG, + ORACLE_WITHDRAWAL_CHUNK_SIZE, REWARD_VOTE_FILENAME, WAD, ) @@ -221,7 +222,7 @@ async def calculate_withdrawal_rewards( ) execution_client = get_web3_client() - chunk_size = 50000 + chunk_size = ORACLE_WITHDRAWAL_CHUNK_SIZE for block_number in range(from_block, to_block, chunk_size): withdrawals_amount += await self.fetch_withdrawal_chunk( validator_indexes=validator_indexes, diff --git a/oracle/settings.py b/oracle/settings.py index d255335..fa78ec2 100644 --- a/oracle/settings.py +++ b/oracle/settings.py @@ -28,6 +28,10 @@ # oracle ORACLE_PROCESS_INTERVAL = config("ORACLE_PROCESS_INTERVAL", default=15, cast=int) +ORACLE_WITHDRAWAL_CHUNK_SIZE = config( + "ORACLE_WITHDRAWAL_CHUNK_SIZE", default=50000, cast=int +) + IPFS_FETCH_ENDPOINTS = config( "IPFS_FETCH_ENDPOINTS",