Skip to content

Commit 954bcdc

Browse files
authoredMay 4, 2024
Merge pull request #1767 from BobTheBuidler/patch-1
feat: add `eager_caching: true` to default-config.yaml
2 parents bd4a2a0 + 6f08cc4 commit 954bcdc

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
 

‎brownie/data/default-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ hypothesis:
7171
autofetch_sources: false
7272
dependencies: null
7373
dev_deployment_artifacts: false
74+
eager_caching: true

‎brownie/network/middlewares/caching.py

+3
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ def start_block_filter_loop(self):
117117

118118
@classmethod
119119
def get_layer(cls, w3: Web3, network_type: str) -> Optional[int]:
120+
if CONFIG.settings['eager_caching'] is False:
121+
# do not cache when user doesn't want it
122+
return None
120123
if network_type != "live":
121124
# do not cache on development chains
122125
return None

‎docs/config.rst

+7
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,10 @@ Other Settings
390390
.. code-block:: yaml
391391
392392
dotenv: .env
393+
394+
.. py:attribute:: eager_caching
395+
If set to ``false``, brownie will not start the background caching thread and will only call the RPC on an as-needed basis.
396+
397+
This is useful for always-on services or while using pay-as-you-go private RPCs
398+
399+
default value: ``true``

0 commit comments

Comments
 (0)