diff --git a/y/ENVIRONMENT_VARIABLES.py b/y/ENVIRONMENT_VARIABLES.py index 53d0b5728..d028be63a 100644 --- a/y/ENVIRONMENT_VARIABLES.py +++ b/y/ENVIRONMENT_VARIABLES.py @@ -10,6 +10,15 @@ ) """TTL for contract cache, defaults to :obj:`CACHE_TTL` if not set""" +CONTRACT_THREADS = _envs.create_env( + "CONTRACT_THREADS", + PruningThreadPoolExecutor, + default=10, + string_converter=int, + verbose=False, +) +"""The number of threads to use to fetch contract abis""" + GETLOGS_BATCH_SIZE = _envs.create_env("GETLOGS_BATCH_SIZE", int, default=0) """Batch size for getlogs operations, 0 will use default as determined by your provider.""" diff --git a/y/contracts.py b/y/contracts.py index cf027277d..5edeefa8d 100644 --- a/y/contracts.py +++ b/y/contracts.py @@ -49,8 +49,6 @@ logger = logging.getLogger(__name__) -contract_threads = a_sync.PruningThreadPoolExecutor(16) - _brownie_deployments_db_lock = threading.Lock() # These tokens have trouble when resolving the implementation via the chain. @@ -473,7 +471,7 @@ async def _coroutine( Returns: A Contract instance for the given address. """ - contract = await contract_threads.run( + contract = await ENVS.CONTRACT_THREADS.run( cls, address, require_success=require_success )