Skip to content

Commit

Permalink
Merge pull request #1767 from BobTheBuidler/patch-1
Browse files Browse the repository at this point in the history
feat: add `eager_caching: true` to default-config.yaml
  • Loading branch information
iamdefinitelyahuman authored May 4, 2024
2 parents bd4a2a0 + 6f08cc4 commit 954bcdc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions brownie/data/default-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ hypothesis:
autofetch_sources: false
dependencies: null
dev_deployment_artifacts: false
eager_caching: true
3 changes: 3 additions & 0 deletions brownie/network/middlewares/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def start_block_filter_loop(self):

@classmethod
def get_layer(cls, w3: Web3, network_type: str) -> Optional[int]:
if CONFIG.settings['eager_caching'] is False:
# do not cache when user doesn't want it
return None
if network_type != "live":
# do not cache on development chains
return None
Expand Down
7 changes: 7 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,10 @@ Other Settings
.. code-block:: yaml
dotenv: .env
.. py:attribute:: eager_caching
If set to ``false``, brownie will not start the background caching thread and will only call the RPC on an as-needed basis.

This is useful for always-on services or while using pay-as-you-go private RPCs

default value: ``true``

0 comments on commit 954bcdc

Please sign in to comment.